Difference between revisions of "Create Assets"
(Created page with "== Summary == {| border="1" class="wikitable" ! Create Asset ! colspan="2" | |- ! URL | colspan="2" | http://base_url/api_path/version/assets |- ! Type | colspan="2" |POST ...") |
|||
| Line 35: | Line 35: | ||
== Example JSON == | == Example JSON == | ||
| + | {"assets":[{ | ||
| + | "external_id":"sss32", | ||
| + | "item_id":{"name":"Woo"}, | ||
| + | "serial_number":"serialNo123", | ||
| + | "description":"describingwords", | ||
| + | "location":"aPlace", | ||
| + | "job_id":{"job_number":"123"}, | ||
| + | "customer_id":{"name":"john"}, | ||
| + | "status_id":{"status":"test"} | ||
| + | }]} | ||
| + | |||
| + | <source lang="java"> | ||
| + | |||
| + | |||
| + | </source> | ||
== Example curl request == | == Example curl request == | ||
Revision as of 13:22, 5 August 2013
Contents |
Summary
| Create Asset | ||
|---|---|---|
| URL | http://base_url/api_path/version/assets | |
| Type | POST | |
| Params: | api_key | required |
| file | required | |
| update_existing | optional (default = false) | |
| validate_only | optional (default = false) | |
| Response | JSON | |
The 'create asset' method accepts an array of assets to be added to the system. If the 'update_existing' parameter is set, then any existing assets will be updated in the system. If set to false or not provided, then any asset where the serial number is not unique will be rejected.
If 'validate_only' is set, the assets will only be validated but not actually inserted into the database. This can be used to check an entire dataset for errors before submitting.
JSON Parameters
Example JSON
{"assets":[{ "external_id":"sss32", "item_id":{"name":"Woo"}, "serial_number":"serialNo123", "description":"describingwords", "location":"aPlace", "job_id":{"job_number":"123"}, "customer_id":{"name":"john"}, "status_id":{"status":"test"} }]}
Example curl request
curl -F validate_only=false -F update_existing=true -F api_key=darren_web_api -F file=@/Users/user/Desktop/webAPICurling/create_asset.txt http://live.mymobileworkers.com:8080/api/1/assets