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.
Multi Part Form Data
JSON As Body
JSON Contents
The JSON file is passed in the post as the "file"
| Field
|
Expected Data
|
Required
|
| name
|
varchar(45) |
✓
|
| order_position
|
int(4) |
✓
|
| folder_key
|
varchar(45) |
✓
|
| notes
|
varchar(45) |
|
Fields exclusive to JSON body format:
| Standard Fields
|
| Field
|
Expected Data
|
Required
|
| key
|
string - company api key |
✓
|
| validate_only
|
boolean |
|
| update_existing
|
boolean |
|
Example Input
Multi Part Form Data
{"folders":[
{
"name":"folder_test",
"notes":"testing",
"order_position":1,
"folder_key":"folder_key"
}
]}
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"
}
]
}
Example Curl Requests
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
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":1,
"folder_key":"folder_key"
}
]
}' http://api.mymobileworkers.com:8080/api/1/companies/company/attachment_folders
Responses
Example JSON
{
"result":"failed",
"failed":[
{
"item":{
"name":"item2",
"type":null,
"notes":null,
},
"errors":[
{
"error_code":"JBI002",
"error_message":"Job item type is null"
}
]
}
],
"valid":[
{
"name":"item1",
"type":"C",
"notes":"notes",
"barcodes":"barcode,barcode1"
}
]
}