This API uses POST
request to communicate and HTTP response codes to indenticate status and errors. All responses come in standard JSON. All requests must include a content-type
of application/json
and the body must be valid JSON.
200: Success
400: Bad request
401: Unauthorized
404: Cannot be found
405: Method not allowed
422: Unprocessable Entity
50X: Server Error
100: Bad Request
110: Unauthorized
120: User Authenticaion Invalid
130: Parameter Error
140: Item Missing
150: Conflict
160: Server Error
http code 402
{
"code": 120,
"message": "invalid crendetials",
"resolve": "The username or password is not correct."
}
You send: Your login credentials.
You get: An API-Token
with wich you can make further actions.
Request:
POST /login HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: xy
{
"username": "foo",
"password": "1234567"
}
Successful Response:
HTTP/1.1 200 OK
Server: My RESTful API
Content-Type: application/json
Content-Length: xy
{
"apitoken": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"expirationDate": "2018-02-13T15:31:55.559Z"
}
Failed Response:
HTTP/1.1 401 Unauthorized
Server: My RESTful API
Content-Type: application/json
Content-Length: xy
{
"code": 120,
"message": "invalid crendetials",
"resolve": "The username or password is not correct."
}