(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:
Name | Description | Type | Required | Example values |
---|
name | | String | yes | |
isVan | By default, it is set to false | Boolean | no | true, false |
parentId | Required if isVan equal to true | Integer/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 |
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."
}