Skip to content

Working with Documents

This guide covers how documents are used in Mobiledock and the process required to integrate with them via the REST API.

Before proceeding, it is recommended that you follow the Integration Setup guide.

In Mobiledock, a document is a record of a pre-determined reason to visit a Mobiledock-controlled site. Most commonly, documents model a Purchase Order (PO), an Advanced Shipping Notice (ASN), or a Work Order.

  • Ensures individuals creating a booking have a valid reason to be on site
  • Less data is required from the booker — much of it can be pre-filled
  • Earlier visibility of specific orders for better resource planning
  • Your organisation has API access, location functionality, and document functionality enabled
  • You have created an API token with Document Observation and Document Management permissions
  • You have a working Mobiledock configuration with connections to suppliers, receivers, and carriers

The unique identifier of the document, entered by users when creating a booking at your site.

Either Inbound or Outbound, depending on the nature of the visit.

The occupant is the organisation that occupies the location. The offsite is the remote organisation. The carrier handles transport.

When using the REST API, reference organisations by their Core ID — a mapping between your system’s identifiers and Mobiledock’s internal organisations. At least one of occupant, offsite, or carrier must be defined on a document.

Loads model the units related to a document. Each line contains:

PropertyDescription
Load TypeThe type of load, referenced by name or ID
QuantityThe number of units for this line
Load Tag (optional)An identifier for this line (e.g. an SKU)

Document mode determines how a document can be booked against:

ModeDescription
FreeThe load may be modified by the booker
FixedThe load cannot be modified by the booker
FlexibleLoad quantities may be modified, but load types cannot
PropertyDescription
Valid DatesTime window when bookings can be scheduled (both optional)
Preferred DatesPreferred delivery dates shown to users (both optional)
Max UsesMaximum number of bookings against this document
DescriptionOptional text displayed to the user when booking
AttributesOptional key-value store for integration metadata
StatusOptional state indicator (e.g. “High Priority”)
TypeOptional classification (e.g. “PO”, “ASN”)

In this example, we create a document for organisation 990090c9-7506-487b-9872-c4e65557ae75:

{
"id": "PO-2000",
"direction": "Inbound",
"occupant": {
"id": "990090c9-7506-487b-9872-c4e65557ae75"
},
"offsite": {
"coreName": "SUPPLIER",
"coreId": "0001"
},
"loads": [
{ "name": "Cartons", "quantity": 500, "loadTag": "SKU-199" },
{ "name": "Cartons", "quantity": 1000, "loadTag": "SKU-094" }
],
"settings": {
"mode": "Fixed",
"maxUses": 1
},
"validDates": {
"begin": "2024-09-01T21:00:00Z",
"end": "2024-10-01T21:00:00Z"
},
"preferredDates": {
"end": "2024-09-15T21:00:00Z"
},
"attributes": {
"PRIORITY": "1",
"SUPPLIER_CATEGORY": "03"
},
"status": { "name": "High Priority" },
"type": { "name": "PO" }
}

The recommended method is the upsert operation — it updates an existing document if it exists, or creates a new one.

Terminal window
curl -X PUT \
"https://my.mobiledock.com/api/v2/organisations/990090c9-7506-487b-9872-c4e65557ae75/documents/PO-2000?upsert=true" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d @document.json

By default, the API rejects documents when the Core ID and Core Name do not match an existing connection. To automatically create a new organisation when details can’t be matched, add enableBaseOrgs=true to the query string:

/api/v2/organisations/{orgId}/documents/{docId}?upsert=true&enableBaseOrgs=true
Status CodeDescription
200Document updated successfully
201Document created successfully
400Payload issue — details in response body

Batch jobs are an efficient way to submit large numbers of documents at once. A single payload containing many documents is processed asynchronously.

Send a JSON array of documents as an HTTP POST to:

/api/v2/organisations/{orgId}/document-jobs/

All documents use the upsert method. Add enableBaseOrgs=true and selfCoreId=DC as needed:

Terminal window
curl -X POST \
"https://my.mobiledock.com/api/v2/organisations/990090c9-7506-487b-9872-c4e65557ae75/document-jobs?enableBaseOrgs=true&selfCoreId=DC" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '[{ ... }, { ... }]'
MethodEndpointDescription
GET/api/v2/organisations/{orgId}/document-jobs/List all batch jobs
GET/api/v2/organisations/{orgId}/document-jobs/{batchId}Get batch job details
GET/api/v2/organisations/{orgId}/document-jobs/{batchId}/resultGet batch job results
DELETE/api/v2/organisations/{orgId}/document-jobs/{batchId}Cancel an in-progress batch

Send an HTTP GET request to the document resource:

Terminal window
curl "https://my.mobiledock.com/api/v2/organisations/990090c9-7506-487b-9872-c4e65557ae75/documents/PO-2000" \
-H "Authorization: Bearer YOUR_TOKEN"

The response includes resolved organisation details including addresses and connection attributes.

Deleting a document prevents additional bookings from being created against it. Existing bookings retain their document reference.

Terminal window
curl -X DELETE \
"https://my.mobiledock.com/api/v2/organisations/990090c9-7506-487b-9872-c4e65557ae75/documents/PO-2000" \
-H "Authorization: Bearer YOUR_TOKEN"

If you have further questions, contact us at assistance@mobiledock.com.