Difference between revisions of "Create Company Attachment Folders"
From MyMobileWorkers API
(Created page with " == Summary == A company folder can be created via two different methods - either as multi-part form data with a JSON file attached and the API key as a parameter, or as JSON...") |
(→JSON As Body) |
||
| (17 intermediate revisions by one user not shown) | |||
| Line 8: | Line 8: | ||
{| border="1" class="wikitable" | {| border="1" class="wikitable" | ||
| − | ! Create | + | ! Create Item |
! colspan="2" | | ! colspan="2" | | ||
|- | |- | ||
! URL | ! URL | ||
| − | | colspan="2" | http:// | + | | colspan="2" | http://base_url/api_path/version/companies/company/attachment_folders |
|- | |- | ||
! Type | ! Type | ||
| Line 21: | Line 21: | ||
|- | |- | ||
! | ! | ||
| − | | | + | | file || required |
|- | |- | ||
! | ! | ||
| − | | | + | | update_existing || optional (default = false) |
|- | |- | ||
! | ! | ||
| − | | | + | | validate_only || optional (default = false) |
|- | |- | ||
! Response | ! Response | ||
| Line 39: | Line 39: | ||
|- | |- | ||
! URL | ! URL | ||
| − | | colspan="2" | http://:base_url/:api_path/:version/ | + | | colspan="2" | http://:base_url/:api_path/:version/companies/company/attachment_folders |
|- | |- | ||
! Type | ! Type | ||
| Line 45: | Line 45: | ||
|- | |- | ||
! | ! | ||
| − | | JSON <br /> {key | + | | JSON <br /> {key, validate_only(optional), update_existing(optional), folders[]} ||| required |
|- | |- | ||
! Response | ! Response | ||
| Line 59: | Line 59: | ||
! Required | ! Required | ||
|- | |- | ||
| − | ! name | + | ! name |
| varchar(45) || ✓ | | varchar(45) || ✓ | ||
|- | |- | ||
| − | ! | + | ! order_position |
| − | + | ||
| − | + | ||
| − | + | ||
| int(4) || ✓ | | int(4) || ✓ | ||
|- | |- | ||
| − | ! | + | ! folder_key |
| − | | varchar(45) || | + | | varchar(45) || ✓ |
|- | |- | ||
! notes | ! notes | ||
| − | + | | varchar(45) || | |
| − | + | ||
| − | + | ||
| − | | varchar(45) || | + | |
|- | |- | ||
|} | |} | ||
| Line 89: | Line 83: | ||
! key | ! key | ||
| string - company api key || ✓ | | string - company api key || ✓ | ||
| − | |||
| − | |||
| − | |||
|- | |- | ||
! validate_only | ! validate_only | ||
| Line 97: | Line 88: | ||
|- | |- | ||
! update_existing | ! update_existing | ||
| − | |||
| − | |||
| − | |||
| boolean || | | boolean || | ||
|- | |- | ||
| Line 109: | Line 97: | ||
<source lang="java"> | <source lang="java"> | ||
| − | {" | + | {"folders":[ |
| − | " | + | { |
| − | + | "name":"folder_test", | |
| − | + | "notes":"testing", | |
| − | "notes":" | + | "order_position":1, |
| − | " | + | "folder_key":"folder_key" |
| − | " | + | } |
| − | }]} | + | ]} |
</source> | </source> | ||
| Line 123: | Line 111: | ||
<source lang="java"> | <source lang="java"> | ||
{ | { | ||
| − | "key":" | + | "key":"api_key", |
| − | " | + | "validate_only":"false", |
| − | " | + | "update_existing":true, |
| + | "folders":[ | ||
{ | { | ||
| − | + | "name":"folder_test", | |
| − | + | "notes":"testing", | |
| − | + | "order_position":1, | |
| − | + | "folder_key":"folder_key" | |
| − | + | ||
| − | + | ||
} | } | ||
] | ] | ||
} | } | ||
| + | |||
</source> | </source> | ||
| Line 143: | Line 131: | ||
<source lang="php"> | <source lang="php"> | ||
| − | curl -F validate_only=false -F update_existing=true -F api_key=[YOUR_API_KEY] | + | curl -F validate_only=false -F update_existing=true -F api_key=[YOUR_API_KEY] -F file=@/Users/darrenatherton/Desktop/webAPICurling/create_attachment_folders.txt http://api.mymobileworkers.com:8080/api/1/companies/company/attachment_folders |
</source> | </source> | ||
| Line 149: | Line 137: | ||
<source lang="php"> | <source lang="php"> | ||
| − | curl -X POST -H "Content-Type: application/json" -d '{"key":" | + | curl -X POST -H "Content-Type: application/json" -d '{ "key":"api_key", "validate_only":"false", "update_existing":true, "folders":[ { "name":"folder_test", "notes":"testing", "order_position": "folder_key":"folder_key"} ]}' http://api.mymobileworkers.com:8080/api/1/companies/company/attachment_folders |
</source> | </source> | ||
| Line 158: | Line 146: | ||
<source lang="java"> | <source lang="java"> | ||
{ | { | ||
| − | + | "failed": [], | |
| − | + | "successful": [ | |
| − | + | { | |
| − | + | "customer_name": "folder_test" | |
| − | + | } | |
| − | + | ] | |
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
} | } | ||
</source> | </source> | ||
Latest revision as of 11:03, 12 March 2018
Contents |
[edit] Summary
A company folder can be created via two different methods - either as multi-part form data with a JSON file attached and the API key as a parameter, or as JSON content on it's own, with the API key supplied within the JSON.
[edit] Multi Part Form Data
| Create Item | ||
|---|---|---|
| URL | http://base_url/api_path/version/companies/company/attachment_folders | |
| Type | POST | |
| Params: | api_key | required |
| file | required | |
| update_existing | optional (default = false) | |
| validate_only | optional (default = false) | |
| Response | JSON | |
[edit] JSON As Body
| Create Job - JSON | ||
|---|---|---|
| URL | http://:base_url/:api_path/:version/companies/company/attachment_folders | |
| Type | POST | |
| JSON {key, validate_only(optional), update_existing(optional), folders[]} |
required | |
| Response | JSON | |
[edit] JSON Contents
| Field | Expected Data | Required |
|---|---|---|
| name | varchar(45) | ✓ |
| order_position | int(4) | ✓ |
| folder_key | varchar(45) | ✓ |
| notes | varchar(45) |
| Standard Fields | ||
|---|---|---|
| Field | Expected Data | Required |
| key | string - company api key | ✓ |
| validate_only | boolean | |
| update_existing | boolean | |
[edit] Example Input
[edit] Multi Part Form Data
{"folders":[ { "name":"folder_test", "notes":"testing", "order_position":1, "folder_key":"folder_key" } ]}
[edit] JSON As Body
{ "key":"api_key", "validate_only":"false", "update_existing":true, "folders":[ { "name":"folder_test", "notes":"testing", "order_position":1, "folder_key":"folder_key" } ] }
[edit] Example Curl Requests
[edit] Multi Part Form Data
curl -F validate_only=false -F update_existing=true -F api_key=[YOUR_API_KEY] -F file=@/Users/darrenatherton/Desktop/webAPICurling/create_attachment_folders.txt http://api.mymobileworkers.com:8080/api/1/companies/company/attachment_folders
[edit] JSON As Body
curl -X POST -H "Content-Type: application/json" -d '{ "key":"api_key", "validate_only":"false", "update_existing":true, "folders":[ { "name":"folder_test", "notes":"testing", "order_position": "folder_key":"folder_key"} ]}' http://api.mymobileworkers.com:8080/api/1/companies/company/attachment_folders
[edit] Responses
[edit] Example JSON
{ "failed": [], "successful": [ { "customer_name": "folder_test" } ] }