Create Mobileuser

From MyMobileWorkers API
Revision as of 21:37, 18 May 2017 by Ryanmt (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

Summary

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.


Multi Part Form Data

Create Asset
URL https://base_url/api_path/version/mobile_users
Type POST
Params: api_key required
file required
update_existing optional (default = false)
validate_only optional (default = false)
Response JSON

JSON As Body

Create Job - JSON
URL https://base_url/api_path/version/mobile_users
Type POST
JSON
{key, validate_only(optional), update_existing(optional), assets[]}
required
Response JSON

JSON Contents

The JSON file is passed in the post as the "file"
Standard Fields
Field Expected Data Required
username varchar(32) ✓
email varchar(127)
fullname varchar(32)
password varchar(45) ✓
branch_id {"name":"<branchName>"}
*nested JSON object
engineer_reg_number varchar(45)
contact_number varchar(45)
Fields exclusive to JSON body format:
Standard Fields
Field Expected Data Required
key string - company api key ✓
update_existing boolean
validate_only boolean

Example Input

Multi Part Form Data

JSON As Body

Example Curl Requests

Multi Part Form Data

curl -F validate_only=false -F update_existing=true -F api_key=darren_web_api -F file=@/Users/user/Desktop/webAPICurling/create_asset.txt https://api.mymobileworkers.com:8181/api/1/assets

JSON As Body

curl -X POST -H "Content-Type: application/json" -d '{"key":"darrenwebapi", "validate_only":"false", "update_existing":"true", "assets":[{"external_id":"sss32","item_id":{"name":"Woo"},"serial_number":"serialNo456","description":"describingwords","location":"aPlace2","job_id":{"job_number":"123"},"customer_id":{"name":"john"},"status_id":{"status":"test"},"branch_id":{"name":"DarrenDevTest"},"custom_fields":{"testFieldName1":"testFieldValue1","testFieldName2":"testFieldValue2","testFieldName3":"testFieldValue3"}}]}' http://api.mymobileworkers.com:8080/api/1/assets

Responses

Example JSON

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox