Copyright © 2005-2022
Copies of this document may be made for your own use and for distribution to others, provided that you do not charge any fee for such copies and further provided that each copy contains this Copyright Notice, whether distributed in print or electronically.
Overview
General Terms and Definitions
The next subsections are valid for all entity interactions described in the rest of this document.
HTTP verbs
This RESTful API tries to adhere as closely as possible to standard HTTP and REST conventions in its use of HTTP verbs.
Verb | Usage | Idempotent |
---|---|---|
|
Used to retrieve a resource |
|
|
Used to create a new - not existing - resource (although called transient resource) |
|
|
Used to update an existing resource, including the whole resource in the request body (the resource is called a detached resource) |
|
|
Used to update an existing resource, including partial updates (the resource to update is called a managed resource) |
|
|
Used to delete an existing resource |
|
HTTP status codes
This RESTful API tries to adhere as closely as possible to standard HTTP and REST conventions in its use of HTTP status codes.
Status code | Usage |
---|---|
|
The request completed successfully. Details |
|
A new/transient resource has been created successfully. The resource’s URI is available from the response’s
|
|
An update to an existing resource has been applied successfully. Details |
|
The request was malformed. The response body will include an error providing further information. Details |
|
The requested resource was forbidden to be accessed by the currently authenticated user. Details |
|
The requested resource did not exist. Details |
|
Indicates that the request could not be completed due to a conflict with the current state of the target resource. Details |
Hypermedia
TMS Transportation uses hypermedia links where resources include links to other resources.
Responses are in Hypertext Application
Language (HAL) format. These hyperlinks belong to the technical part of the resource representation
and are grouped with the _links
element. Users of the API should not create URIs themselves,
and use hyperlinks for navigation only.
Resources
The domain model of the RESTful API consists of a couple of classes with simple datatypes and no explicit relationships between each
other. One special implicit type is the Date
type that defines the default date format if not otherwise requested by the consuming
service.
TransportOrder
The main resource of the TMS Transportation module is the TransportOrder
. A TransportOrder
is used in automated warehouses to move TransportUnits
between Locations
. Automated warehouses means a Material Flow Controller (MFC, see Material Flow) uses
TransportOrders
to route and track the movements within the warehouse. In manual warehouse OpenWMS.org uses Movements
to track this in a manually.
The attributes of the TransportOrder
representation:
Attribute | Description |
---|---|
|
A synthetic unique key that identifies |
|
The unique identifier of the TransportUnit that is carried. May be replaced with a link in future. |
|
The priority of the |
|
The timestamp when the |
|
The last error message occurred according to the |
|
The timestamp when the |
|
The current state of the |
|
The |
|
The |
|
The |
Interaction Model
Create a new TransportOrder
At least the Barcode
of the TransportUnit
that needs to be moved and the Target
destination must be given to create a new TransportOrder
.
In this example we also pass the Priority
of the TransportOrder
in order to control the priority of execution. TransportOrders
with a high
priority might be started and executed before those with lower priority.
Request to move a TransportUnit to a Location
In this example we pass a Location
string as Target
. An unique identifier of a LocationGroup
is accepted as well.
$ curl 'http://localhost:8080/v1/transport-orders' -i -X POST \
-H 'Content-Type: application/json;charset=UTF-8' \
-d '{
"pKey" : null,
"barcode" : "4711",
"priority" : "HIGHEST",
"problem" : null,
"state" : null,
"targetLocation" : "ERR_/0000/0000/0000/0000",
"targetLocationGroup" : "ERR_/0000/0000/0000/0000"
}'
If the TransportOrder
has been created successfully, the server responds with http status code 201
and returns the URI of the created
TransportOrder
in the LOCATION
header.
Response if created
HTTP/1.1 201 Created
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Location: http://localhost:8080/v1/transport-orders/89818d78-7777-4e94-8551-42153298a692
The URI can be used to lookup the created TransportOrder
by it’s persistent key. A GET
request would look like this:
Lookup the created TransportOrder
Unresolved directive in api.adoc - include::/home/runner/work/org.openwms.tms.transportation/org.openwms.tms.transportation/target/generated-snippets/to-create-and-get/curl-request.adoc[]
and the server returns the representation of the created TransportOrder
Unresolved directive in api.adoc - include::/home/runner/work/org.openwms.tms.transportation/org.openwms.tms.transportation/target/generated-snippets/to-create-and-get/http-response.adoc[]
Fails to create a TransportOrder
The creation of a TransportOrder
may fail for several reasons. At first the TransportUnit
with the given Barcode
may not exist.
Or the Target
destination is unknown. In both cases the server responds with a http status code 404
(Not Found):
HTTP/1.1 404 Not Found
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Content-Type: application/hal+json;charset=UTF-8
Content-Length: 83
{
"message" : "not.found",
"messageKey" : "not.found",
"httpStatus" : "404"
}
Changing TransportOrders
Created TransportOrders
can be changed. The system allows to redirect or prioritize them under certain circumstances.
For example redirection might only be possible if the TransportOrder
did not already reached the final Target
destination
and is still active. Or prioritization is only allowed with well-known values for the Priority
.
Redirect to a new Target
Existing and active TransportOrders
can be redirected to a new Target
. This redirection happens through an PATCH
request
where the API expects the partial representation of the TransportOrder
as request body. Here an example request to redirect the
TransportOrder
with the given persistent key to a new Target
.
$ curl 'http://localhost:8080/v1/transport-orders/ecb95b53-d210-461a-8daa-15342778cd1e' -i -X PATCH \
-H 'Content-Type: application/json;charset=UTF-8' \
-d '{
"pKey" : "ecb95b53-d210-461a-8daa-15342778cd1e",
"barcode" : "4711",
"priority" : "HIGHEST",
"problem" : null,
"state" : null,
"targetLocation" : "INIT/0000/0000/0000/0000",
"targetLocationGroup" : "INIT/0000/0000/0000/0000"
}'
Change Priority
Changing the Priority
of an TransportOrder
is also requested with a PATCH
request. The follow example shows a request
to lower the Priority
of an existing TransportOrder
, identified by the given persistent key, to NORMAL
.
Notice that the TransportOrder
does not need to be started yet.
$ curl 'http://localhost:8080/v1/transport-orders/6ac03f79-2acf-43c4-9948-0eda198dcd20' -i -X PATCH \
-H 'Content-Type: application/json;charset=UTF-8' \
-d '{
"pKey" : "6ac03f79-2acf-43c4-9948-0eda198dcd20",
"barcode" : "4711",
"priority" : "NORMAL",
"problem" : null,
"state" : null,
"targetLocation" : "ERR_/0000/0000/0000/0000",
"targetLocationGroup" : "ERR_/0000/0000/0000/0000"
}'
If the request has been executed successfully, the server responds with a http status code 204
HTTP/1.1 204 No Content
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
If the server does not accept the passed Priority
level the response status is 400
(Bad Request),
HTTP/1.1 400 Bad Request
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Content-Type: application/hal+json;charset=UTF-8
Content-Length: 129
{
"message" : "A priority level of UNKNOWN is not defined",
"messageKey" : "core.invalid.parameter",
"httpStatus" : "400"
}