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.
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
Status | Meaning | Description |
---|---|---|
200 | OK | OK |
500 | Internal Server Error | Internal Server Error |
Response Schema
Status Code 200
Name | Type | Description |
---|---|---|
- result | object | - |
-- additionalProperties | HomeworkResponse | - |
--- id | hw_id(uuid) | - |
--- no | hw_no(int64) | - |
--- s_code | hw_s_code | - |
--- title | hw_title | - |
--- expire | hw_expire(int64) | UnixDate |
--- comments | [hw_comment] | - |
Status Code 500
Name | Type | Description |
---|---|---|
- error | string | ErrorMessage |
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
Parameter | In | Type | Required | Description |
---|---|---|---|---|
id | path | string(uuid) | true | uuid 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
Status | Meaning | Description |
---|---|---|
200 | OK | OK |
400 | Bad Request | Bad Request |
500 | Internal Server Error | Internal Server Error |
Response Schema
Status Code 200
Name | Type | Description |
---|---|---|
- result | HomeworkResponse | - |
-- id | hw_id(uuid) | - |
-- no | hw_no(int64) | - |
-- s_code | hw_s_code | - |
-- title | hw_title | - |
-- expire | hw_expire(int64) | UnixDate |
-- comments | [hw_comment] | - |
Status Code 400
Name | Type | Description |
---|---|---|
- error | string | ErrorMessage |
Status Code 500
Name | Type | Description |
---|---|---|
- error | string | ErrorMessage |
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
Parameter | In | Type | Required | Description |
---|---|---|---|---|
body | body | HomeworkSend | false | homework detail |
id | path | string(uuid) | true | uuid of the homework |
Example responses
{
"result": {
"status": "OK"
}
}
{
"error": "ErrorMessage"
}
{
"error": "ErrorMessage"
}
Responses
Status | Meaning | Description |
---|---|---|
200 | OK | OK |
400 | Bad Request | Bad Request |
500 | Internal Server Error | Internal Server Error |
Response Schema
Status Code 200
Name | Type | Description |
---|---|---|
- result | object | - |
-- status | string | - |
Status Code 400
Name | Type | Description |
---|---|---|
- error | string | ErrorMessage |
Status Code 500
Name | Type | Description |
---|---|---|
- error | string | ErrorMessage |
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
Parameter | In | Type | Required | Description |
---|---|---|---|---|
id | path | string(uuid) | true | uuid of the homework |
Example responses
{
"result": {
"status": "OK"
}
}
{
"error": "ErrorMessage"
}
{
"error": "ErrorMessage"
}
Responses
Status | Meaning | Description |
---|---|---|
200 | OK | OK |
400 | Bad Request | Bad Request |
500 | Internal Server Error | Internal Server Error |
Response Schema
Status Code 200
Name | Type | Description |
---|---|---|
- result | object | - |
-- status | string | - |
Status Code 400
Name | Type | Description |
---|---|---|
- error | string | ErrorMessage |
Status Code 500
Name | Type | Description |
---|---|---|
- error | string | ErrorMessage |
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
Parameter | In | Type | Required | Description |
---|---|---|---|---|
body | body | object | false | - |
- comment | body | hw_comment | false | - |
id | path | string(uuid) | true | uuid of the homework |
comment_id | path | string(uuid) | true | uuid of the comment |
Example responses
{
"result": {
"status": "OK"
}
}
{
"error": "ErrorMessage"
}
{
"error": "ErrorMessage"
}
Responses
Status | Meaning | Description |
---|---|---|
200 | OK | OK |
400 | Bad Request | Bad Request |
500 | Internal Server Error | Internal Server Error |
Response Schema
Status Code 200
Name | Type | Description |
---|---|---|
- result | object | - |
-- status | string | - |
Status Code 400
Name | Type | Description |
---|---|---|
- error | string | ErrorMessage |
Status Code 500
Name | Type | Description |
---|---|---|
- error | string | ErrorMessage |
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
Parameter | In | Type | Required | Description |
---|---|---|---|---|
id | path | string(uuid) | true | uuid of the homework |
comment_id | path | string(uuid) | true | uuid of the comment |
Example responses
{
"result": {
"status": "OK"
}
}
{
"error": "ErrorMessage"
}
{
"error": "ErrorMessage"
}
Responses
Status | Meaning | Description |
---|---|---|
200 | OK | OK |
400 | Bad Request | Bad Request |
500 | Internal Server Error | Internal Server Error |
Response Schema
Status Code 200
Name | Type | Description |
---|---|---|
- result | object | - |
-- status | string | - |
Status Code 400
Name | Type | Description |
---|---|---|
- error | string | ErrorMessage |
Status Code 500
Name | Type | Description |
---|---|---|
- error | string | ErrorMessage |
Schemas
hw_id
"8ffa1faa-53fd-46be-805b-04d9281ef86e"
Properties
Name | Type | Required | Description |
---|---|---|---|
anonymous | string(uuid) | false | - |
hw_no
1
Properties
Name | Type | Required | Description |
---|---|---|---|
anonymous | integer(int64) | false | - |
hw_s_code
"IW33"
Properties
Name | Type | Required | Description |
---|---|---|---|
anonymous | string | false | - |
hw_title
"課題主題"
Properties
Name | Type | Required | Description |
---|---|---|---|
anonymous | string | false | - |
hw_expire
16000
Properties
UnixDate
Name | Type | Required | Description |
---|---|---|---|
anonymous | number(int64) | false | UnixDate |
hw_comment
"foobar"
Properties
Name | Type | Required | Description |
---|---|---|---|
anonymous | string | false | - |
HomeworkResponse
{
"id": "8ffa1faa-53fd-46be-805b-04d9281ef86e",
"no": 1,
"s_code": "IW33",
"title": "課題主題",
"expire": 16000,
"comments": [
"foobar"
]
}
Properties
Name | Type | Required | Description |
---|---|---|---|
id | hw_id | false | - |
no | hw_no | false | - |
s_code | hw_s_code | false | - |
title | hw_title | false | - |
expire | hw_expire | false | - |
comments | [hw_comment] | false | - |
HomeworkSend
{
"no": 1,
"s_code": "IW33",
"title": "課題主題",
"expire": 16000
}
Properties
Name | Type | Required | Description |
---|---|---|---|
no | hw_no | false | - |
s_code | hw_s_code | false | - |
title | hw_title | false | - |
expire | hw_expire | false | - |