How to Call API
This section is intended to describe how to call the SwiftFederation LSDN APIs.
Request Definition
- API Server Host
Host: lsdn-api.swiftfederation.com
- Request Protocol
https
- Request Protocol
POST
Field | Required | Type | Description |
---|---|---|---|
Authorization | Mandatory | String | Used to validate request if legal or not. Please refer to "Authentication". |
Content-Type | Mandatory | String | Request content type. E.g. Content-Type: application/json; charset=utf-8 |
X-SFD-Date | Mandatory | String | Date of request. Format is yyyyMMdd’T’HHmmss’Z’. E.g. 20180328T173013Z. The difference between request date and server date can not exceed 1 hour. |
X-SFD-Nonce | Mandatory | Long | Random number. Recommend using 5 digits. (No longer than 128 digits) |
- Request Example
POST /v1.0/report/bandwidth HTTP/1.1
Host: lsdn-api.swiftfederation.com
Authorization: HMAC-SHA256 lsdn123456:8d60df6f67690c25130b93e96363f166c812bc7fdee9c6fcfdb3d0f8eda1c01b
Content-Type: application/json; charset=utf-8
X-SFD-Date: 20180330T200550Z
X-SFD-Nonce: 90355
{ "domains":["www.example1.com","www.example2.com"], "startTime":"2018-03-29T17:35:00Z", "endTime":"2018-03-29T17:45:00Z" }
Response Definition
This section is intended to describe response header and body data definition.
HTTP/1.1 200 OK
[
{
"domain": "www.example1.com",
"bandwidths": [
{
"timestamp": "2018-03-29T17:35:00Z",
"value": 1.01
},
{
"timestamp": "2018-03-29T17:40:00Z",
"value": 3.01
}
]
},
{
"domain": "www.example2.com",
"bandwidths": [
{
"timestamp": "2018-03-29T17:35:00Z",
"value": 4.04
},
{
"timestamp": "2018-03-29T17:40:00Z",
"value": 7.04
}
]
}
]
- Error Response Definition
Name | Type | Description |
---|---|---|
code | string | Error code identification. |
message | string | Error message description. |
- Error Response Definition
HTTP/1.1 400
{
code:"DomainName.Invalid",
message:"Domain name is empty or invalid."
}
HTTP/1.1 400
{
code:"AccessCredential.Unauthroized",
message:"Failed to authorize access credential and signature."
}
HTTP/1.1 401
{
code:"StartTime.ValueNotSupported",
message:"The difference between EndTime and StartTime cannot exceed 24 hours"
}