Restful Actions
1. Introduction
As shown in Create Request , you can use your preferred tools to monitor Restful Actions between our web application with the server.
Chrome | Safari | Firefox |
---|---|---|
Most of the API End Points are accessible via GET/PUT/POST/DELETE actions. All you need to do is to simulate the actions in your application.
Please be aware to ease the difference between browsers, we treat PUT and POST actions as the same.
We use 'id' field in requests to distinguish Add and Update action. One action is treated as Update if there's valid 'id' value (exist and not NULL), otherwise it would be treated as Add action.
2. Examples
for example: consignments
Add
URI | http://test.birdsystem.com/client/consignment |
Method | POST |
Content-Type | application/json |
URL Param | - |
Body Param | |
Response |
Query Single Record Detail
URI | http://test.birdsystem.com/client/consignment |
Method | GET |
Content-Type | application/json |
URL Param | id=1707170020000004 |
Body Param | - |
Response |
Query Records List
URI | http://test.birdsystem.com/client/consignment |
Method | GET |
Content-Type | application/json |
URL Param | start=0&limit=50&sort=[{"property":"update_time","direction":"DESC"}] |
start: the return record list start offset, , Optional Default 0 | |
Body Param | - |
Response | { "total":914567, "data":Array[50], "success":true, "currency":"CNY", "moduleName":"admin" } |
The common query params when query record list
When we query record list, we have another common query params besides the param "start", "limit", "sort",seeing below (the following params should send to server by GET request)
param | type | note | examples |
selectFields | string | the columns which should be return when query record list (this value should be URL encoded) | such as we need to return fields : status,is_urgent,total_weight,total_volume_weight,type,update_time,create_time. we should concat these field names with comma, then do URL encoded finally, the url params should be: selectFields=status%2Cis_urgent%2Ctotal_weight%2Ctotal_volume_weight%2Ctype%2Cupdate_time%2Ccreate_time |
filter | string | the filter condition which should be applied when query record list (this value should be URL encoded) | such as we need to query the consignment list which status is FINISHED ,and last update time is newer than 2017-09-10,条the query conditions should be : [ {"type":"date","comparison":"gt","value":"2017-09-10","field":"update_time"}, {"type":"list","value":["FINISHED"],"field":"status"} ]. after url encoded,the url params should be: filter=5B%7B%22type%22%3A%22date%22%2C%22comparison%22%3A%22gt%22%2C%22value%22%3A%222017-09-10%22%2C%22field%22%3A%22update_time%22%7D%2C%7B%22type%22%3A%22list%22%2C%22value%22%3A %5B%22FINISHED%22%5D%2C%22field%22%3A%22status%22%7D%5D |
custom defined filter field by each table list | string | In order to fullfill the different requirements, some API can use query filter on some frequently used fields. we can directly send params "fieldname=fieldvalue" to these API. Please refer to the relevant API documentation for the conditions available for each API | such as Product list,frequently query by client_ref or status,so we support this two fileds used as custom filter。 then we can use this fields as url params: client_ref=IPxxx or status=PENDING (you can use multi conditions in same time) |
Modify
URI | http://test.birdsystem.com/client/consignment |
Method | POST |
Content-Type | application/json |
URL Param | id=1707170020000004 |
Body Param | |
Response |
Delete
URI | http://test.birdsystem.com/client/consignment |
Method | DELETE |
Content-Type | application/json |
URL Param | id=1707170020000004 |
Body Param | - |
Response | { "success":true, "message":"Delete Successfully", "refresh":false, "moduleName":"client" } |
3. More
all table list in birdsystem can action with Restful.