(Quick Reference)
Service: Create a warehouse
Description: Returns the created warehouse in json format when successful. Returns a json response, describing the failure condition when unsuccessful.
URL:
https://BASE_URL/api/VERSION/warehouses
Method: POST
Request content type: application/json
Parameters:
Name | Description | Type | Required | Example values |
---|
reference | | String | yes | |
name | | String | yes | |
isVan | By default, it is set to false | Boolean | no | true, false |
parentId | Required if isVan equal to true | Long/String | - | |
description | | String | no | |
address | | String | no | |
users | Required if isVan equal to false | List | - | [18,19] |
userId | Required if isVan equal to true | Integer/String | - | 21 |
useExternalId | By default, it is set to false. set it to true if you want to use external ids. | Boolean | no | true , false |
reference must be unique
Success Output
Status: HTTP/1.1 201 Created
{
"id": 3,
"name": " john van",
"reference": "van_17",
"isRoot": false,
"parentReference": "wh-01",
"parentWhse": {
"id": 2,
"reference": "wh-01",
"name": "Main warehouse",
"href": "/api/v1.0/warehouses/2"
},
"description": null,
"address": null,
"isVan": true,
"users": [
{
"id": 21,
"reference": "emp_21",
"href": "/api/v1.0/users/21"
}
],
"organization": "entity1",
"dateCreated": "2015-12-15T16:58:03Z",
"lastUpdated": "2015-12-15T16:58:03Z"
}
Failure Output
Status: HTTP/1.1 400 Bad Request
{
"error": "missing_param",
"error_description": "name parameter is missing"
}
Status: HTTP/1.1 404 Not Found
{
"error": "already_assigned",
"error_description": "The user with the id 19 is already assigned to another warehouse/van."
}
{
"error": "not_found",
"error_description": "The parent warehouse with the id 255 doesn't exist."
}