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 disaggregate trade items (packs) from one parent trade item (pack) using the Manufacturer V2 API.


API Tool to Use


In this document, we provide examples by using the cURL command-line tool. To send the API request, you can find a lot of user-friendly REST API tools on the Internet, for example, Postman.


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 the DELETE method and the following URL:


https://api.movilitas.cloud/v1/manufacturer/v2/api/aggregate/trade_item


2. For the header, define the content type (JSON), the authentication token, and the channel key.


The token can be given in one of the following ways:

  • As x-access-token header.
  • As Authorization header by using the Bearer schema.


Header Option 1


KeyAction
Content-TypeApply JSON format for the content. Use the value application/json.
x-access-tokenProvide the authentication token.
x-channel-keyProvide the channel key of your Manufacturer V2 API channel.


Header Option 2


KeyAction
Content-TypeApply JSON format for the content. Use the value application/json.
AuthorizationProvide the authentication token as Bearer <token>.
x-channel-keyProvide 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.


FieldRequired or Optional?TypeDescription
parentRequiredObjectThe object containing the parent details.
       product_codeRequiredStringProduct code.
       product_code_schemaRequiredStringProduct code schema. The application supports one value, "GTIN".
       serial_numberRequiredStringSerial number of the product.
       batchOptionalStringProduct batch.
       expiry_dateOptionalStringExpiry 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.
child_trade_itemsRequiredObject[]The array of child item objects aggregated by the parent. Each object contains the details of a child item.
       product_codeRequiredStringProduct code.
       product_code_schemaRequiredStringProduct code schema. The application supports one value, "GTIN".
       serial_numberRequiredStringSerial number of the product.
       batchOptionalStringProduct batch.
       expiry_dateOptionalStringExpiry 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.


4. Send the request.



Sample cURL Request


curl -X DELETE \
  https://api.movilitas.cloud/v1/manufacturer/v2/api/aggregate/trade_item \
  -H 'Content-Type: application/json' \
  -H 'x-access-token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJrZXkiOiJzX2FqazQyS2RLQWhHciE3TUZtY1Q2UzhTQ3NDQ2hzc2RoTXRFUlNBIUNwUDhlZDkzU2htQ0hoaHIyTmg3Y0dBIiwiX2lkIjoiNWQyNzA4ZDc3NDQ1OTcxYjI5MmY4ZDI3IiwiaWF0IjoxNTY0MDU5ODc2LCJleHAiOjE1NjQxNDYyNzZ9.TBMv71CaxCNtE1opQMk0f1ncfbnZ0Cwnu7MWkTzkQqA' \
  -H 'x-channel-key: Ky1SpfEXmjj05fW3USBFD3pgoEi9AQ29Atsnj4Zy' \
  -d '{
    "parent": {
        "product_code": "12345678909040",
        "product_code_schema": "GTIN",
        "serial_number": "06FAT3FLH45RWM5A5BSG",
        "batch": "BATCH002",
        "expiry_date": "221200"
    },
    "child_trade_items": [
        {
            "product_code": "12345123459040",
            "product_code_schema": "GTIN",
            "serial_number": "N5EB6V25R0180GJTWJ4D",
            "batch": "BATCH002",
            "expiry_date": "221200"
        },
        {
            "product_code": "12345123459040",
            "product_code_schema": "GTIN",
            "serial_number": "VMXTRD299WN92AS43E9M",
            "batch": "BATCH002",
            "expiry_date": "221200"
        },
        {
            "product_code": "12345123459040",
            "product_code_schema": "GTIN",
            "serial_number": "CFY63JPERADFPD94H6P1",
            "batch": "BATCH002",
            "expiry_date": "221200"
        },
        {
            "product_code": "12345123459040",
            "product_code_schema": "GTIN",
            "serial_number": "49SCT34E2G0XCBJZZ9TA",
            "batch": "BATCH002",
            "expiry_date": "221200"
        }
    ]
}'



Sample Response (Success 200


{
    "success": true,
    "message": "Disaggregated from trade item"
}



Error Types and Resolution


This section lists some of the most general error types when sending the request.


Error Message or Error TypeError CodeDescription
No token providedERR0001No authentication token is provided. Ensure that you add the authentication token to the header of the request.
Failed to authenticate tokenERR0000Failed 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.
Channel ID is missing or it needs to be in correct format-The channel key of your Manufacturer V2 API channel is not specified in the request. To get the channel key, go to Tenant Dashboard --> Channels in the Admin UI, open your Manufacturer V2 API channel, and find the channel key on the top of the Edit shopfloor channel panel.
Request body could not be parsed-The syntax of the request body is not correct, for example, a comma is missing at the end of a field. Make sure that the request body is defined in the correct way and that you use JSON format.
Validation error-The given data is invalid. It does not follow the required data type or pattern. The response includes details about the specific issue. Follow the explanation in the response and correct your data.
Product doesn't exist-The product does not exist. Register the product in the Serialized Manufacturing application --> Products tab in the Admin UI.