You can use the Manufacturer V2 API to integrate the shopfloor and the enterprise resource planning (ERP) systems with the Serialized Manufacturing application.
The Manufacturer V2 API uses the Representational State Transfer (REST) standard to interact with other systems.
The Manufacturer V2 API is an extension of the Serialized Manufacturing application of Movilitas.Cloud that enables you to send requests from external systems to the application.
The following figure provides an overview of all the requests that you can send by using the Manufacturer V2 API:
This article describes how to create a packaging order using the Manufacturer V2 API.
API Tool to Use
In this document, we provide examples by using the cURL command-line tool. You can use any API tool to perform the API requests, for example, Postman or Katalon Studio.
Before You Begin
1. You must enable the Serialized Manufacturing application.
2. You must create an API key and secret.
3. You must create a shopfloor channel with the Manufacturer V2 API source. You will need the channel key for your requests.
4. You must configure the Serialized Manufacturing application and the channels required to connect to external systems.
5. You must have the authentication token to send requests over API. Select one of the following ways:
- Apply a dynamic token. Send an authentication request over the Authentication API. For more information about the Authentication API, open the Tenant Dashboard in Movilitas.Cloud, select API keys, and choose Authentication API Documentation. Also, see Authentication Request.
- Apply a static token. Generate a static token for your previously created API key.
For more information, see Configuring the Movilitas.Cloud APIs.
Procedure
1. Use POST method and the following URL:
https://api.movilitas.cloud/v1/manufacturer/v2/api/packaging_order
2. For the header, define the following:
Key | Action |
---|---|
Content-Type | Apply JSON format for the content. Use the value application/json. |
x-access-token | Provide the authentication token. |
x-channel-key | Provide the channel key of your Manufacturer V2 API channel. |
3. In the body of the request, define the parameters and their values based on the table below.
Field | Required or Optional? | Type | Description |
---|---|---|---|
batch | Optional | String | Product batch. The allowed character length is 1-255 characters. |
expiry_date | Optional | String | Expiry date of the product. The date format is YYMMDD. For the last day of the month, '00' is accepted, for example 2022-December-31 can be written as 221200. |
extra_percentage | Optional | Number | Extra percentage over the requested amount of serial numbers, between 0 and 100. It ensures an additional number of serial numbers in case the serial numbers are damaged during production. For example, if you request 1000 serial numbers and you state "10" as extra percentage, an extra of 100 serial numbers will be created. |
market | Optional | String | Market ID. It can be EU, US, CHN, or IDN. Apply the value that was given during the product code registration in the Serialized Manufacturing application. Note: Before registering a product code in the Serialized Manufacturing application, you need to create the applicable market profile under the Serialized Manufacturing application --> Settings tab. |
order_description | Optional | String | Order description. The allowed character length is 1-255 characters. |
order_id | Required | String | Order ID. The allowed character length is 1-255 characters. |
packaging_line_tag | Optional | String | Identifies the packaging line to which the order is going to be sent. Note: Make sure that you have registered a packaging line in the Serialized Manufacturing application, under the Packaging --> Packaging lines tab and you apply the value that was given in the Packaging line tag field. |
product_code_schema | Required | String | Product code schema. The application supports one value, "GTIN". |
product_code | Required | String | Product code. The allowed character length is 1-255 characters. |
quantity | Optional | Number | The amount of serial numbers (cartons) to be produced. The value range is 0-100000. |
serialized | Optional | Boolean | Ensures that the order will be created with serials when setting it to "true". The allowed value is "true" or "false". |
4. Send the request. The order is created that you can check in the Serialized Manufacturing application --> Packaging --> Packaging orders tab.
Sample cURL Request
curl -X POST \ https://api.movilitas.cloud/v1/manufacturer/v2/api/packaging_order \ -H 'Content-Type: application/json' \ -H 'x-access-token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJrZXkiOiJzX2FqazQyS2RLQWhHciE3TUZtY1Q2UzhTQ3NDQ2hzc2RoTXRFUlNBIUNwUDhlZDkzU2htQ0hoaHIyTmg3Y0dBIiwiX2lkIjoiNWQyNzA4ZDc3NDQ1OTcxYjI5MmY4ZDI3IiwiaWF0IjoxNTY0MDU5ODc2LCJleHAiOjE1NjQxNDYyNzZ9.TBMv71CaxCNtE1opQMk0f1ncfbnZ0Cwnu7MWkTzkQqA' \ -H 'x-channel-key: Ky1SpfEXmjj05fW3USBFD3pgoEi9AQ29Atsnj4Zy' \ -d '{ "batch": "BATCH111", "expiry_date": "221115", "extra_percentage": 10, "market": "EU", "order_description":"Packaging Order 130", "order_id": "Order130", "packaging_line_tag": "test-packaging-line-1", "product_code_schema": "GTIN", "product_code": "01234512345900", "quantity": 10, "serialized": true }'
Sample Response (Success 200)
{ "success": true, "message": "Packaging order created", "data": { "order_id": "Order130", "order_description": "Packaging Order 130", "product_code": "01234512345900", "product_code_schema": "GTIN", "batch": "BATCH111", "expiry_date": "221115", "quantity": 10, "extra_percentage": 10, "serialized": true, "packaging_line_tag": "test-packaging-line-1", "market": "EU", "status": "Open" } }
Admin UI Example
Error Types and Resolution
This section lists some of the most general error types when sending the request.
Error Type | Description |
---|---|
NoTokenError | No authentication token is provided. Ensure that you add the authentication token to the header of the request. |
InvalidTokenError | Failed to authenticate the provided token. Double-check if your token has expired or has been revoked. Obtain a valid token by generating a static one or by getting a dynamic one through Authentication API. |
ValidationError | The data or its format is not valid. Make sure you give the data in JSON format as described above. |