(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:

NameDescriptionTypeRequiredExample values
reference Stringyes 
name Stringyes 
isVanBy default, it is set to falseBooleannotrue, false
parentIdRequired if isVan equal to trueLong/String- 
description Stringno 
address Stringno 
usersRequired if isVan equal to falseList-[18,19]
userIdRequired if isVan equal to trueInteger/String-21
useExternalIdBy default, it is set to false. set it to true if you want to use external ids.Booleannotrue , 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."
}