(Quick Reference)
Service: Create a loading
Description: Returns the created loading in json format when successful. Returns a json response, describing the failure condition when unsuccessful.
URL:
https://BASE_URL/api/VERSION/loadings
Method: POST
Request content type: application/json
Parameters:
Name | Description | Type | Required | Example values |
---|
reference | | String | yes | |
warehouseId | | Integer/String | yes | |
type | Should be equal to 1 for loading or 2 for unloading | Integer | yes | 1,2 |
reasonId | Id of reason with type "3" ( warehouse transaction) | Long | no | |
useExternalId | By default, it is set to false. set it to true if you want to use external ids. | Boolean | no | true , false |
Loading details parameter :
Parameter name:
loadingDetails
Parameter type: a json structure
Name | Description | Type | Required | Example values |
---|
itemUnitId | | Long | yes | |
quantity | | Long | yes | |
serialNumbers | List of serial numbers id | JSON list | no | [750,711] |
realQty | The real available quantity in van stock, used when van unloading, by default, it is fixed to the available quantity. | integer | no | 20 |
Serial numbers parameter is only used when van loading
For each loaded item, serial numbers are accepted with only one item unit.
If realQty parameter is specified, system will calculate the availability of requested quantity in relation to the real available quantity in van stock
Example:
{
"reference": "10Crates",
"warehouseId": 2,
"type": 1,
"loadingDetails": [{
"itemUnitId": 1,
"quantity": 10
}]
}
Success Output
Status: HTTP/1.1 201 Created
{
"id": 3,
"reference": "10Crates",
"warehouseReference": "entrepotA",
"warehouse": {
"id": 4,
"reference": "entrepotA",
"name": "entrepot A",
"href": "/api/v1.0/warehouses/4"
},
"warehouseType": "1",
"reason": {
"id": 2,
"name": "whse transaction",
"href": "/api/v1.0/reasons/2"
},
"type": "1",
"status": "1",
"loadingDetails": [
{
"id": 8,
"itemId": 495,
"unitId": 1,
"quantity": 10,
"realAvailableQty": null,
"availableQty": null,
"href": "/api/v1.0/loadingDetails/8"
}
],
"organization": "entity1",
"dateCreated": "2016-01-25T16:27:33Z",
"lastUpdated": "2016-01-25T16:27:33Z"
}
Failure Output
Status: HTTP/1.1 400 Bad Request
{
"error": "not_unique",
"error_description": "reference already used"
}
{
"error": "invalid_param_type",
"error_description": "The type of parameter warehouseId you provided is not valid for this request."
}
{
"error": "quantity_not_available",
"error_description": "Quantity should be less than or equal to the available quantity"
}
{
"error": "invalid_serial_number",
"error_description": "The number of serial codes should be equal to the reserved quantity"
}
{
"error": "invalid_serial_status",
"error_description": "The serial number status with id 2704563 is not equal to new."
}
{
"error": "invalid_param_type",
"error_description": "The type of parameter serial number id you provided is not valid for this request."
}
Status: HTTP/1.1 404 Not Found
{
"error": "not_found",
"error_description": "The warehouse with the id 707 doesn't exist."
}
{
"error": "not_found",
"error_description": "The reason with the id 25 doesn't exist."
}
{
"error": "not_found",
"error_description": "The serial number with the id 1 doesn't exist."
}