(Quick Reference)

56 Loadings - Reference Documentation

Version: 2.1

56 Loadings

56.1 List

Service: List loadings

Description: This web service returns a json list of loadings.

URL:

https://BASE_URL/api/VERSION/loadings

Method: GET

Parameters:

Pagination parameters:

NameDescriptionTypeRequiredPossible values
maxLimits the number of resources requested to return.Integerno 
offsetTells where to start returning records from the entire set of results.Integerno 
orderOrders ascending or descending.Integernoasc,desc
sortOrders the results by the specified field.Stringno 

The max parameter is set to 100 by default.

Filters parameters:

NameDescriptionTypeRequiredExample values
dateCreated_gtFilters by the resource's creation date time and operator greater thanDateno2016-08-15T14:52:48Z
dateCreated_gteFilters by the resource's creation date time and operator greater than or equalDateno 
dateCreated_ltFilters by the resource's creation date time and operator less thanDateno 
dateCreated_lteFilters by the resource's creation date time and operator less than or equalDateno 
lastUpdated_gtFilters by the resource's last-modified date time and operator greater thanDateno 
lastUpdated_gteFilters by the resource's last-modified date time and operator greater than or equalDateno 
lastUpdated_ltFilters by the resource's last-modified date time and operator less thanDateno 
lastUpdated_lteFilters by the resource's last-modified date time and operator less than or equalDateno 
referenceWildcard search by the resource's referenceStringnoreference=Ref-6* , reference=*ef-6 , reference=*ef-6*

Dates should be formatted as the ISO-8601 format (YYYY-MM-DDTHH:MM:SSZ)

Success Output

Status: HTTP/1.1 200 OK

{
  "paging": {
    "total": 51,
    "max": 5,
    "offset": 0,
    "previous": null,
    "next": "/api/v1.0/loadings?max=5&offset=5&sort=dateCreated&order=asc"
  },
  "data": [
    {
      "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": 7,
          "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": "invalid_param",
  "error_description": "The parameters [dateCreated_gta] you provided are not valid for this request."
}

56.2 Show

Service: Show a loading

Description: Returns the requested loading in json format when successful. Returns a json response, describing the failure condition when unsuccessful.

URL:

https://BASE_URL/api/VERSION/loadings/{id}

URL with external_id:

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

Method: GET

Parameters:

NameDescriptionTypeRequiredExample values
idThe ID of the desired loadingLong/Stringyes123

Success Output

Status: HTTP/1.1 200 OK

{
      "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": 7,
          "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 404 Not Found

{
  "error": "not_found",
  "error_description": "The loading with the id 389 doesn't exist."
}

56.3 Create

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:

NameDescriptionTypeRequiredExample values
reference Stringyes 
warehouseId Long/Stringyes 
typeShould be equal to 1 for loading or 2 for unloadingIntegeryes1,2
reasonIdId of reason with type "3" ( warehouse transaction)Integerno 
useExternalIdBy default, it is set to false. set it to true if you want to use external ids.Booleannotrue , false

Loading details parameter :

Parameter name: loadingDetails

Parameter type: a json structure

NameDescriptionTypeRequiredExample values
itemUnitId Integeryes 
quantity Integeryes 
serialNumbersList of serial numbers idJSON listno[750,711]
realQtyThe real available quantity in van stock, used when van unloading, by default, it is fixed to the available quantity.integerno20

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

56.4 Update

Service: Update a loading

Description: Returns the updated loading in json format when successful. Returns a json response, describing the failure condition when unsuccessful.

URL:

https://BASE_URL/api/VERSION/loadings/{id}

URL with external_id:

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

Method: PUT

Request content type: application/json

Parameters:

NameDescriptionTypeRequiredExample values
idThe ID of the desired loadingLong/Stringyes123
reference Stringyes 
warehouseId Long/Stringyes 
typeShould be equal to 1 for loading or 2 for unloadingIntegeryes1,2
reasonIdid of reason with type "3" ( warehouse transaction)Integerno 

Loading details parameter :

Parameter name: loadingDetails

Parameter type: a json structure

NameDescriptionTypeRequiredExample values
itemUnitId Integeryes 
quantity Integeryes 
serialNumbersList of serial numbers idJSON listno[750,711]
realQtyThe real available quantity in van stock, used when van unloading, by default, it is fixed to the available quantity.integerno20

Serial numbers 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 200 OK

{
      "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-25T17:27:33Z"
}

Failure Output

Status: HTTP/1.1 404 Not Found

{
  "error": "not_found",
  "error_description": "The loading with the id 707 doesn't exist."
}

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

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_param_type",
  "error_description": "The type of parameter serial number id you provided is not valid for this request."
}

{
  "error": "invalid_serial_status",
  "error_description": "The serial number status with id 2704563 is sold, or already reserved in another loading."
}

{
  "error": "invalid_serial_number",
  "error_description": "The number of serial codes should be equal to the reserved quantity"
}

56.5 Upsert

Service: Upsert a loading

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

URL with external_id:

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

Method: POST

Request content type: application/json

Parameters:

NameDescriptionTypeRequiredExample values
reference Stringyes 
warehouseId Stringyes 
typeShould be equal to 1 for loading or 2 for unloadingIntegeryes1,2
reasonIdId of reason with type "3" ( warehouse transaction)Integerno 

Loading details parameter :

Parameter name: loadingDetails

Parameter type: a json structure

NameDescriptionTypeRequiredExample values
itemUnitId Integeryes 
quantity Integeryes 
serialNumbersList of serial numbers idJSON listno[750,711]
realQtyThe real available quantity in van stock, used when van unloading, by default, it is fixed to the available quantity.integerno20

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

56.6 Delete

Service: Delete a loading

Description: Returns a json response.

URL:

https://BASE_URL/api/VERSION/loadings/{id}

URL with external_id:

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

Method: DELETE

Parameters:

NameDescriptionTypeRequiredExample values
idThe ID of the desired loadingLong/Stringyes123

Success Output

Status: HTTP/1.1 200 OK

{
  "success": "true",
  "success_description": "Instance deleted successfully"
}

Failure Output

Status: HTTP/1.1 400 Bad Request

{
  "error": "delete_failed",
  "error_description": "Failed to delete instance."
}

Status: HTTP/1.1 404 Not Found

{
  "error": "not_found",
  "error_description": "The loading with the id 706 doesn't exist."
}