This repository was archived by the owner on Nov 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
NYCU ME APIs Docs
Cycatz edited this page Feb 25, 2022
·
9 revisions
現 API Server: api.nycu.me,需 HTTPS
Header: Authorization 欄位為 Bearer {token}
Example.
curl https://api.nycu.me/ -H "Authorization: Bearer {token}
exp, iat, iss, nbf, uid, username, email
當你從 portal 登入之後,他會 redirect 到某個 url,其中會傳遞一個 code 參數,你可以使用這個 code 來向 backend 詢問使用者的 token,之後將 token 存入 cookie,在每次呼叫 APIs 時傳入。
| Status Code | Description |
|---|---|
| 200 | Ok and token returned |
| 401 | code has expired |
Example.
# curl https://api.nycu.me/oauth/{code}
{
"token": {token}
}
| Status Code | Description |
|---|---|
| 200 | Ok and user's data returned |
| 401 | not logged or invalid token |
{
"domains": [
{
"domainName": {},
"expDate": {},
"id": {},
"regDate": {}
"records": [
{
"ttl": {}, "type": {}, "value": {}
},
...
]
},
...
],
"email": {},
"limit": {},
"uid": {},
"username": {}
}
Error Types:
- NotAllowedDomain
- NumberLimitExceed
- AssignedDomainName
- PermissionDenied
You would call https://api.nycu.me/domains/me/nycu/test in order to apply test.nycu.me.
You must be logged to do it.
| Status Code | Description |
|---|---|
| 200 | Ok |
| 401 | Not logged |
| 403 | Logged but not allowed(Error Types below) |
Example:
# Calling https://api.nycu.me/domains/me/nctu/test
Status: 403
{
"errorType": "DNSErrors.NotAllowedDomain",
"msg": "test.nctu.me is not allowed."
}
# Calling https://api.nycu.me/domains/me/nycu/test
Status: 200
{
"msg": "ok
}
Similar to apply one.
You must be logged to do it.
| Status Code | Description |
|---|---|
| 200 | Ok |
| 401 | Not logged |
| 403 | Logged but not allowed(Error Types below) |
Example.
# Calling https://api.nycu.me/domains/me/nycu/test
Status: 403
{
"errorType": "DNSErrors.AssignedDomainName",
"msg": "test.nycu.me is not being used."
}
# Calling https://api.nycu.me/domains/me/nycu/test
Status: 200
{
"msg": "ok"
}
You must be logged to do it.
You must be logged to do it.
| Status Code | Description |
|---|---|
| 200 | Ok |
| 401 | Not logged |
| 403 | Logged but not allowed(Error Types below) |
Allowed types:
| Types | Means |
|---|---|
| A | IPv4 |
| AAAA | IPv6 |
| CNAME | Alias |
| MX | Mail Exchanger |
| TXT |
Example.
# Calling https://api.nycu.me/ddns/me/nycu/test/records/A/140.113.89.32
Status: 200
{
"msg": "ok"
}
You can pass a JSON in request body, which contains one integer element ttl, where 0 < ttl <= 86400.
Similar to add one.
You must be logged to do it.
| Status Code | Description |
|---|---|
| 200 | Ok |
| 401 | Not logged |
| 403 | Logged but not allowed(Error Types below) |
Example.