Revisions
-
simonwep revised this gist
Feb 14, 2018 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,9 +7,9 @@ This API uses `POST` request to communicate and HTTP [response codes](https://en 200: Success 400: Bad request 401: Unauthorized 404: Cannot be found 405: Method not allowed 422: Unprocessable Entity 50X: Server Error ``` ### Error Codes Details @@ -19,7 +19,8 @@ This API uses `POST` request to communicate and HTTP [response codes](https://en 120: User Authenticaion Invalid 130: Parameter Error 140: Item Missing 150: Conflict 160: Server Error ``` ### Example Error Message ```json -
simonwep created this gist
Feb 13, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,74 @@ # API Documentation Example This API uses `POST` request to communicate and HTTP [response codes](https://en.wikipedia.org/wiki/List_of_HTTP_status_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. ## Response Codes ### Response Codes ``` 200: Success 400: Bad request 401: Unauthorized 402: Request failed 404: Cannot be found 405: Method not allowed 50X: Server Error ``` ### Error Codes Details ``` 100: Bad Request 110: Unauthorized 120: User Authenticaion Invalid 130: Parameter Error 140: Item Missing 150: Server Error ``` ### Example Error Message ```json http code 402 { "code": 120, "message": "invalid crendetials", "resolve": "The username or password is not correct." } ``` ## Login **You send:** Your login credentials. **You get:** An `API-Token` with wich you can make further actions. **Request:** ```json POST /login HTTP/1.1 Accept: application/json Content-Type: application/json Content-Length: xy { "username": "foo", "password": "1234567" } ``` **Successful Response:** ```json 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:** ```json 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." } ```