You can use the Manufacturer for Agro API to integrate the third-party systems with the Manufacturer for Agro application.


The Manufacturer for Agro API uses the Representational State Transfer (REST) standard to interact with other systems.


The Manufacturer for Agro API is an extension of the Manufacturer for Agro application of Movilitas.Cloud and enables you to send requests from external systems to the application.


This article describes how to create a production order by using the Manufacturer for Agro 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


Before you start sending any messages:


1. You must enable the Manufacturer for Agro application in the Admin UI.

2. You must create an API key and secret. 

3. You must create a shopfloor channel with Manufacturer for Agro API source. You will need the channel key for your requests.

4. You must configure the Manufacturer for Agro application and the channel required to connect to SAP AII in the Admin UI.

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


https://api.movilitas.cloud/v1/manufacturer_agro/v1/api/production_order


2. For the header, define the following:


KeyAction
Content-TypeApply JSON format for the content. Use the value application/json.
x-access-tokenProvide the authentication token.


3. In the body of the request, define the parameters and their values based on the table below.


FieldRequired or Optional?TypeDescription
channel_keyRequiredStringThe channel key of your Manufacturer for Agro API channel. 
order_idRequiredStringOrder ID
product_codeRequiredStringProduct code for the output product as per the GS1 standard.
product_code_typeRequiredStringProduct code type for the output product. The application supports one value, "GTIN".
product_descriptionOptionalStringProduct description for the output product.
quantityOptionalNumberThe quantity of the output product.
unit_of_measurementOptionalStringThe unit of measurement for the quantity of the output product. For example, "Liter" or "Kg". Mandatory when the quantity is provided.
batchOptionalStringBatch of the output product as per the GS1 standard.
expiry_dateOptionalStringExpiry date of the output product in the "YYMMDD" format. For the last day of the month, '00' is accepted, for example, 2022-December-31 can be written as 221200.
scheduled_startOptionalString

Scheduled start date/time as per ISO 8601 for the order.


The applied format is "YYYY-MM-DD HH:MMZ" (UTC).

scheduled_endOptionalString

Scheduled end date/time as per ISO 8601 for the order.


The applied format is "YYYY-MM-DD HH:MMZ" (UTC).

bom
RequiredObject[]

Bill of materials. Contains the list of input materials and their details as objects.

      product_codeRequiredStringItem product code as per the GS1 standard.
      product_code_typeRequiredStringItem product code type. The application supports one value, "GTIN".
      product_descriptionOptionalStringItem product description
      quantityRequiredNumberThe required quantity of the material.
      unit_of_measurementRequiredStringThe unit of measurement for the quantity of the material. For example, "Liter" or "Kg".
      batchOptionalStringItem batch as per the GS1 standard
      ssccOptionalStringItem SSCC as per the GS1 standard
      serial_numberOptionalStringItem serial number
      serial_number_typeOptionalStringThe type of the item serial number. The value is either SGTIN or Customer. Mandatory if the serial number is provided.


4. Send the request. After creation, the production order is listed under the Manufacturer for Agro application -->  Production orders tab in Open status.


Sample cURL Request


curl -X POST \
  https://api-dev.movilitas.cloud/v1/manufacturer_agro/v1/api/production_order \
  -H 'Content-Type: application/json' \
  -H 'x-access-token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJrZXkiOiJzX2FqazQyS2RLQWhHciE3TUZtY1Q2UzhTQ3NDQ2hzc2RoTXRFUlNBIUNwUDhlZDkzU2htQ0hoaHIyTmg3Y0dBIiwiX2lkIjoiNWQyNzA4ZDc3NDQ1OTcxYjI5MmY4ZDI3IiwiaWF0IjoxNTY0MDU5ODc2LCJleHAiOjE1NjQxNDYyNzZ9.TBMv71CaxCNtE1opQMk0f1ncfbnZ0Cwnu7MWkTzkQqA' \
  -d '{
    "channel_key": "QL6faDom0pvnuhTTgwwZyStl52VCMxHqsZSd547w",
    "order_id": "ORDER115",
    "product_code": "01122334455667",
    "product_code_type": "GTIN",
    "product_description": "Salty Water",
    "quantity": 100,
    "unit_of_measurement": "Liter",
    "batch": "ENO9A1010",
    "expiry_date": "231200",
    "bom": 
    [
        {
        "product_code": "01234567891000",
        "product_code_type": "GTIN",
        "product_description": "Water",     
        "quantity": 80,
        "unit_of_measurement": "Liter",
        "sscc": "000000000000000110",
        "serial_number": "A1B2C3100",
        "serial_number_type": "Customer",
        "batch": "ENO9B1010"
        },
        {
        "product_code": "01234567891001",
        "product_code_type": "GTIN",
        "product_description": "Salt",      
        "quantity": 20,
        "unit_of_measurement": "Kg",
        "sscc": "000000000000000210",
        "serial_number": "A1B2C4100",
        "serial_number_type": "Customer",
        "batch": "ENO9C1010"
        }
    ]
}'


Sample Response (Success 200)


{
    "success": true,
    "message": "Production order created"
}