Difference between revisions of "Update Custom List"
From MyMobileWorkers API
(→JSON As Body) |
(→JSON As Body) |
||
| Line 43: | Line 43: | ||
! | ! | ||
| JSON <br /> {branch} ||| optional | | JSON <br /> {branch} ||| optional | ||
| + | |- | ||
| + | |- | ||
| + | ! | ||
| + | | JSON <br /> {list} ||| required | ||
| + | |- | ||
| + | ! | ||
| + | | JSON <br /> {list} ||| required | ||
| + | |- | ||
| + | ! | ||
| + | | JSON <br /> {list} ||| required | ||
| + | |- | ||
| + | ! | ||
| + | | JSON <br /> {list} ||| required | ||
|- | |- | ||
! Response | ! Response | ||
Revision as of 14:21, 27 July 2017
Contents |
Summary
The Update Custom List API call allows an existing list to be updated with a new name, description and list items by giving the list key within the request. When updating the list, it will delete any existing items in the custom list and replace with the items provided in the response.
A custom list can be updated via two different methods - either as multi-part form data, or as JSON content on its own, with the API key supplied within the JSON.
Multi Part Form Data
| Update Customer Name | ||
|---|---|---|
| URL | http://base_url/api_path/version/lists/edit | |
| Type | POST | |
| Params: | key | required |
| Response | JSON | |
JSON As Body
| Create Job - JSON | ||
|---|---|---|
| URL | http://base_url/api_path/version/list/edit | |
| Type | POST | |
| JSON {key} |
required | |
| JSON {branch} |
optional | |
| JSON {list} |
required | |
| JSON {list} |
required | |
| JSON {list} |
required | |
| JSON {list} |
required | |
| Response | JSON | |
JSON Contents
{ "key":"APIKEY", "branch_name":"BranchA", "list":{ "name":"Delivery sites", "description":"A list of delivery sites in the area", "list_key":"delivery_site1", "list_items":[ { "name":"Aldcliffe Site", "notes":"small", "order_position":5 }, { "name":"Bond Estate", "notes":"medium", "order_position":6 } ] } }
Example Curl Request
Multi Part Form Data
curl -F api_key=YOUR_KEY http://api.mymobileworkers.com:8080/api/1/lists/edit
JSON As Body
curl -X POST -H "Content-Type: application/json" -d '{"key":"YOUR_KEY"}' http://api.mymobileworkers.com:8080/api/1/lists/edit
Responses
Successful
{ "successful": { "list_name": "Delivery sites", "branch_name": null } }
Unsuccessful
{"error_code": "LIS002", "error_message": "List not found."} {"error_code": "LIS001", "error_message": "List key not provided. Please include in request."} { "error_code": "LIS004", "error_message": "No items were provided."}