NAV Navigation
Node.js HTTP curl Go Python

HW Manager API v1.0.0

Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.

mochiya98/hw_manager_api

API Endpoint:

License: The MIT License

hws

homeworks

getAllHomeworks

Code samples

const request = require('node-fetch');

const headers = {
  'Accept':'application/json'

};

fetch('http://127.0.0.1:3014/api/v1/hw_manager/hws',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

GET http://127.0.0.1:3014/api/v1/hw_manager/hws HTTP/1.1
Host: 127.0.0.1:3014

Accept: application/json

# You can also use wget
curl -X GET http://127.0.0.1:3014/api/v1/hw_manager/hws \
  -H 'Accept: application/json'

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "http://127.0.0.1:3014/api/v1/hw_manager/hws", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('http://127.0.0.1:3014/api/v1/hw_manager/hws', params={

}, headers = headers)

print r.json()

GET /hws

Get all homeworks

Example responses

{
  "result": {
    "87a31500-10d4-4264-b332-77b2b0e92a6c": {
      "comments": [
        "gaog"
      ],
      "id": "87a31500-10d4-4264-b332-77b2b0e92a6c",
      "expire": 17659,
      "no": 1,
      "s_code": "IW31",
      "title": "主題未設定"
    }
  }
}
{
  "error": "ErrorMessage"
}

Responses

StatusMeaningDescription
200OKOK
500Internal Server ErrorInternal Server Error

Response Schema

Status Code 200

NameTypeDescription
- resultobject-
-- additionalPropertiesHomeworkResponse-
--- idhw_id(uuid)-
--- nohw_no(int64)-
--- s_codehw_s_code-
--- titlehw_title-
--- expirehw_expire(int64)UnixDate
--- comments[hw_comment]-

Status Code 500

NameTypeDescription
- errorstringErrorMessage

getHomework

Code samples

const request = require('node-fetch');

const headers = {
  'Accept':'application/json'

};

fetch('http://127.0.0.1:3014/api/v1/hw_manager/hws/{id}',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

GET http://127.0.0.1:3014/api/v1/hw_manager/hws/{id} HTTP/1.1
Host: 127.0.0.1:3014

Accept: application/json

# You can also use wget
curl -X GET http://127.0.0.1:3014/api/v1/hw_manager/hws/{id} \
  -H 'Accept: application/json'

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "http://127.0.0.1:3014/api/v1/hw_manager/hws/{id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('http://127.0.0.1:3014/api/v1/hw_manager/hws/{id}', params={

}, headers = headers)

print r.json()

GET /hws/{id}

Get a homework

Parameters

ParameterInTypeRequiredDescription
idpathstring(uuid)trueuuid of the homework

Example responses

{
  "result": {
    "id": "8ffa1faa-53fd-46be-805b-04d9281ef86e",
    "no": 1,
    "s_code": "IW33",
    "title": "課題主題",
    "expire": 16000,
    "comments": [
      "foobar"
    ]
  }
}
{
  "error": "ErrorMessage"
}
{
  "error": "ErrorMessage"
}

Responses

StatusMeaningDescription
200OKOK
400Bad RequestBad Request
500Internal Server ErrorInternal Server Error

Response Schema

Status Code 200

NameTypeDescription
- resultHomeworkResponse-
-- idhw_id(uuid)-
-- nohw_no(int64)-
-- s_codehw_s_code-
-- titlehw_title-
-- expirehw_expire(int64)UnixDate
-- comments[hw_comment]-

Status Code 400

NameTypeDescription
- errorstringErrorMessage

Status Code 500

NameTypeDescription
- errorstringErrorMessage

updateHomework

Code samples

const request = require('node-fetch');
const inputBody = '{
  "no": 1,
  "s_code": "IW33",
  "title": "課題主題",
  "expire": 16000
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json'

};

fetch('http://127.0.0.1:3014/api/v1/hw_manager/hws/{id}',
{
  method: 'PUT',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

PUT http://127.0.0.1:3014/api/v1/hw_manager/hws/{id} HTTP/1.1
Host: 127.0.0.1:3014
Content-Type: application/json
Accept: application/json

# You can also use wget
curl -X PUT http://127.0.0.1:3014/api/v1/hw_manager/hws/{id} \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json'

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("PUT", "http://127.0.0.1:3014/api/v1/hw_manager/hws/{id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

r = requests.put('http://127.0.0.1:3014/api/v1/hw_manager/hws/{id}', params={

}, headers = headers)

print r.json()

PUT /hws/{id}

Add/Edit a homework

Body parameter

{
  "no": 1,
  "s_code": "IW33",
  "title": "課題主題",
  "expire": 16000
}

Parameters

ParameterInTypeRequiredDescription
bodybodyHomeworkSendfalsehomework detail
idpathstring(uuid)trueuuid of the homework

Example responses

{
  "result": {
    "status": "OK"
  }
}
{
  "error": "ErrorMessage"
}
{
  "error": "ErrorMessage"
}

Responses

StatusMeaningDescription
200OKOK
400Bad RequestBad Request
500Internal Server ErrorInternal Server Error

Response Schema

Status Code 200

NameTypeDescription
- resultobject-
-- statusstring-

Status Code 400

NameTypeDescription
- errorstringErrorMessage

Status Code 500

NameTypeDescription
- errorstringErrorMessage

removeHomework

Code samples

const request = require('node-fetch');

const headers = {
  'Accept':'application/json'

};

fetch('http://127.0.0.1:3014/api/v1/hw_manager/hws/{id}',
{
  method: 'DELETE',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

DELETE http://127.0.0.1:3014/api/v1/hw_manager/hws/{id} HTTP/1.1
Host: 127.0.0.1:3014

Accept: application/json

# You can also use wget
curl -X DELETE http://127.0.0.1:3014/api/v1/hw_manager/hws/{id} \
  -H 'Accept: application/json'

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("DELETE", "http://127.0.0.1:3014/api/v1/hw_manager/hws/{id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.delete('http://127.0.0.1:3014/api/v1/hw_manager/hws/{id}', params={

}, headers = headers)

print r.json()

DELETE /hws/{id}

Remove a homework

Parameters

ParameterInTypeRequiredDescription
idpathstring(uuid)trueuuid of the homework

Example responses

{
  "result": {
    "status": "OK"
  }
}
{
  "error": "ErrorMessage"
}
{
  "error": "ErrorMessage"
}

Responses

StatusMeaningDescription
200OKOK
400Bad RequestBad Request
500Internal Server ErrorInternal Server Error

Response Schema

Status Code 200

NameTypeDescription
- resultobject-
-- statusstring-

Status Code 400

NameTypeDescription
- errorstringErrorMessage

Status Code 500

NameTypeDescription
- errorstringErrorMessage

updateHomeworkComment

Code samples

const request = require('node-fetch');
const inputBody = '{
  "comment": "foobar"
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json'

};

fetch('http://127.0.0.1:3014/api/v1/hw_manager/hws/{id}/comments/{comment_id}',
{
  method: 'PUT',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

PUT http://127.0.0.1:3014/api/v1/hw_manager/hws/{id}/comments/{comment_id} HTTP/1.1
Host: 127.0.0.1:3014
Content-Type: application/json
Accept: application/json

# You can also use wget
curl -X PUT http://127.0.0.1:3014/api/v1/hw_manager/hws/{id}/comments/{comment_id} \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json'

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("PUT", "http://127.0.0.1:3014/api/v1/hw_manager/hws/{id}/comments/{comment_id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

r = requests.put('http://127.0.0.1:3014/api/v1/hw_manager/hws/{id}/comments/{comment_id}', params={

}, headers = headers)

print r.json()

PUT /hws/{id}/comments/{comment_id}

Add/Edit comment to a homework

Body parameter

{
  "comment": "foobar"
}

Parameters

ParameterInTypeRequiredDescription
bodybodyobjectfalse-
- commentbodyhw_commentfalse-
idpathstring(uuid)trueuuid of the homework
comment_idpathstring(uuid)trueuuid of the comment

Example responses

{
  "result": {
    "status": "OK"
  }
}
{
  "error": "ErrorMessage"
}
{
  "error": "ErrorMessage"
}

Responses

StatusMeaningDescription
200OKOK
400Bad RequestBad Request
500Internal Server ErrorInternal Server Error

Response Schema

Status Code 200

NameTypeDescription
- resultobject-
-- statusstring-

Status Code 400

NameTypeDescription
- errorstringErrorMessage

Status Code 500

NameTypeDescription
- errorstringErrorMessage

removeHomeworkComment

Code samples

const request = require('node-fetch');

const headers = {
  'Accept':'application/json'

};

fetch('http://127.0.0.1:3014/api/v1/hw_manager/hws/{id}/comments/{comment_id}',
{
  method: 'DELETE',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

DELETE http://127.0.0.1:3014/api/v1/hw_manager/hws/{id}/comments/{comment_id} HTTP/1.1
Host: 127.0.0.1:3014

Accept: application/json

# You can also use wget
curl -X DELETE http://127.0.0.1:3014/api/v1/hw_manager/hws/{id}/comments/{comment_id} \
  -H 'Accept: application/json'

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("DELETE", "http://127.0.0.1:3014/api/v1/hw_manager/hws/{id}/comments/{comment_id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.delete('http://127.0.0.1:3014/api/v1/hw_manager/hws/{id}/comments/{comment_id}', params={

}, headers = headers)

print r.json()

DELETE /hws/{id}/comments/{comment_id}

Remove comment from a homework

Parameters

ParameterInTypeRequiredDescription
idpathstring(uuid)trueuuid of the homework
comment_idpathstring(uuid)trueuuid of the comment

Example responses

{
  "result": {
    "status": "OK"
  }
}
{
  "error": "ErrorMessage"
}
{
  "error": "ErrorMessage"
}

Responses

StatusMeaningDescription
200OKOK
400Bad RequestBad Request
500Internal Server ErrorInternal Server Error

Response Schema

Status Code 200

NameTypeDescription
- resultobject-
-- statusstring-

Status Code 400

NameTypeDescription
- errorstringErrorMessage

Status Code 500

NameTypeDescription
- errorstringErrorMessage

Schemas

hw_id

"8ffa1faa-53fd-46be-805b-04d9281ef86e"

Properties

NameTypeRequiredDescription
anonymousstring(uuid)false-

hw_no

1

Properties

NameTypeRequiredDescription
anonymousinteger(int64)false-

hw_s_code

"IW33"

Properties

NameTypeRequiredDescription
anonymousstringfalse-

hw_title

"課題主題"

Properties

NameTypeRequiredDescription
anonymousstringfalse-

hw_expire

16000

Properties

UnixDate

NameTypeRequiredDescription
anonymousnumber(int64)falseUnixDate

hw_comment

"foobar"

Properties

NameTypeRequiredDescription
anonymousstringfalse-

HomeworkResponse

{
  "id": "8ffa1faa-53fd-46be-805b-04d9281ef86e",
  "no": 1,
  "s_code": "IW33",
  "title": "課題主題",
  "expire": 16000,
  "comments": [
    "foobar"
  ]
}

Properties

NameTypeRequiredDescription
idhw_idfalse-
nohw_nofalse-
s_codehw_s_codefalse-
titlehw_titlefalse-
expirehw_expirefalse-
comments[hw_comment]false-

HomeworkSend

{
  "no": 1,
  "s_code": "IW33",
  "title": "課題主題",
  "expire": 16000
}

Properties

NameTypeRequiredDescription
nohw_nofalse-
s_codehw_s_codefalse-
titlehw_titlefalse-
expirehw_expirefalse-