You should send your Username
and Password
through a Basic Auth
header.
get-ducks
Return a list of all ducks
Parameter | Content |
---|---|
URL | /get-ducks |
Method | GET |
Successful Response | {"success":true,"response":[{"id":1,"name":"duck","price":10,"created":{"date":"2021-01-20 15:46:02.000000","timezone_type":3,"timezone":"Europe/London"}},{"id":2,"name":"duck","price":10,"created":{"date":"2021-01-20 15:46:02.000000","timezone_type":3,"timezone":"Europe/London"}}]} |
Error Response | Invalid Credentials {"name":"Unauthorized","message":"Your request was made with invalid credentials.","code":0,"status":401,"type":"yii\\web\\UnauthorizedHttpException"} |
get-ducks/1
Return a specific duck from supplied ID
Parameter | Content |
---|---|
URL | /get-ducks/<id> |
Method | GET |
Successful Response | {"success":true,"response":[{"id":9,"name":"duck","price":10,"created":{"date":"2021-01-20 15:46:02.000000","timezone_type":3,"timezone":"Europe/London"}}]} |
Error Response | Invalid Credentials {"name":"Unauthorized","message":"Your request was made with invalid credentials.","code":0,"status":401,"type":"yii\\web\\UnauthorizedHttpException"} No Record {"name":"Bad Request","message":"A duck does not exist with that id.","code":0,"status":400,"type":"yii\\web\\BadRequestHttpException"} Not your duck {"name":"Unauthorized","message":"You do not have permissions to select this duck.","code":0,"status":401,"type":"yii\\web\\UnauthorizedHttpException"} |
set-ducks
Add a new duck
Parameter | Content |
---|---|
URL | /set-ducks |
Method | POST |
Request Body | {"name":"Duck","price":"20.00"} |
Successful Response | {"success":true,"response":[{"id":1,"name":"duck","price":10,"created":{"date":"2021-01-20 15:46:02.000000","timezone_type":3,"timezone":"Europe/London"}}]} |
Error Response | Invalid Credentials {"name":"Unauthorized","message":"Your request was made with invalid credentials.","code":0,"status":401,"type":"yii\\web\\UnauthorizedHttpException"} Failed Addition {"name":"Bad Request","message":"Failed to add new duck.","code":0,"status":400,"type":"yii\\web\\BadRequestHttpException"} |
Request Body must be sent as JSON
Required Parameters
Name | Type |
---|---|
Name | string |
Price | float i.e. 20.00 |
set-ducks/1
Update existing duck from provided ID
Parameter | Content |
---|---|
URL | /set-ducks/<id> |
Method | POST |
Request Body | {"name":"Duck","price":"20.00"} |
Successful Response | {"success":true,"response":[{"id":1,"name":"duck","price":10,"created":{"date":"2021-01-20 15:46:02.000000","timezone_type":3,"timezone":"Europe/London"}}]} |
Error Response | Invalid Credentials {"name":"Unauthorized","message":"Your request was made with invalid credentials.","code":0,"status":401,"type":"yii\\web\\UnauthorizedHttpException"} No Record {"name":"Bad Request","message":"A duck does not exist with that id.","code":0,"status":400,"type":"yii\\web\\BadRequestHttpException"} Not your duck {"name":"Unauthorized","message":"You do not have permissions to update this duck.","code":0,"status":401,"type":"yii\\web\\UnauthorizedHttpException"} Failed Update {"name":"Bad Request","message":"Failed to update this duck.","code":0,"status":400,"type":"yii\\web\\BadRequestHttpException"} |
Request Body must be sent as JSON
Required Parameters
Name | Type |
---|---|
Name | string |
Price | float i.e. 20.00 |
delete-duck/1
Delete a specific duck from supplied ID
Parameter | Content |
---|---|
URL | /delete-duck/<id> |
Method | POST |
Successful Response | {"success":true} |
Error Response | Invalid Credentials {"name":"Unauthorized","message":"Your request was made with invalid credentials.","code":0,"status":401,"type":"yii\\web\\UnauthorizedHttpException"} No Record {"name":"Bad Request","message":"A duck does not exist with that id.","code":0,"status":400,"type":"yii\\web\\BadRequestHttpException"} Not your duck {"name":"Unauthorized","message":"You do not have permissions to remove this duck.","code":0,"status":401,"type":"yii\\web\\UnauthorizedHttpException"} Failed Removal {"name":"Bad Request","message":"Failed to remove this duck.","code":0,"status":400,"type":"yii\\web\\BadRequestHttpException"} |