(Quick Reference) Service: Upsert a warehouse

Description: This web service is used to insert a warehouse object to the database if it does not already exist, or update it.

URL with external_id:

https://BASE_URL/api/VERSION/warehouses/reference/{id}

Method: POST

Request content type: application/json

Parameters:

NameDescriptionTypeRequiredExample values
name Stringyes 
isVanBy default, it is set to falseBooleannotrue, false
parentIdRequired if isVan equal to trueInteger/String- 
description Stringno 
address Stringno 
usersRequired if isVan equal to falseList-[18,19]
userIdRequired if isVan equal to trueInteger/String-21

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."
}