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


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


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


This article describes how to send a Create Order request to Movilitas.Cloud by using the Manufacturer for Pharma 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 Pharma application in the Admin UI.

2. You must create an API key and secret. 

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

4. You must configure the Manufacturer for Pharma 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 POST method and the following URL:


https://api.movilitas.cloud/v1/manufacturer/v1/api/create_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 Pharma API channel. 
gtin
Required
StringThe Global Trade Item Number (GTIN) of the product.
order_numberRequired
StringOrder number
ppnOptionalStringThe PPN of the product
descriptionOptionalStringDescription of the order
amountRequiredNumber
The number of serials (cartons) to be produced.
extraOptionalString

Extra amount (in %; max 100; default: 0). When a value other than 0 is given, the field ensures that there are enough serial numbers in case any errors happen during production.

lotRequiredStringLot number (batch)
exp_dateRequiredStringExpiry date (YYMMDD)
serializedOptionalBooleanSerialized flag (default: true). When this flag is set to "true", it ensures that the order will be created with serials.
line_tagRequiredStringIdentifies the packaging line to which the order is going to be sent.

Note: Make sure that you have registered a packaging line in the Manufacturer for Pharma application, under the Packaging lines tab and you apply the value that was given in the Tag field.
market_idOptionalStringMarket ID (EU)


4. Send the request.



Sample cURL Request


curl -X POST \
  https://api.movilitas.cloud/v1/manufacturer/v1/api/create_order \
  -H 'Content-Type: application/json' \
  -H 'x-access-token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJrZXkiOiJzX2FqazQyS2RLQWhHciE3TUZtY1Q2UzhTQ3NDQ2hzc2RoTXRFUlNBIUNwUDhlZDkzU2htQ0hoaHIyTmg3Y0dBIiwiX2lkIjoiNWQyNzA4ZDc3NDQ1OTcxYjI5MmY4ZDI3IiwiaWF0IjoxNTYzOTU3MjA4LCJleHAiOjE1NjQwNDM2MDh9.dYGzl-K1UT8jAeb-XQ0n_chI8VJzKRJiXhtnU4GenPc' \
  -d '{
   "channel_key": "4nDgThpFEKrza1xtuQsD6fDBCPceBTQuAEB3GuTS",
   "gtin": "01234567891122",
   "order_number": "Order001",
   "amount": 10,
   "lot": "LOT1234",
   "exp_date": "220904",
   "line_tag": "packaging-line-001",
   "market_id": "EU"
}'


Generic
Generic
Sample Response (Success 200)


{
   "success": true,
   "message": "Order created",
   "order": {
      "status": "Open",
      "target_market": "EU",
      "line_order_status": "",
      "serialized": true,
      "amount": 10,
      "extra_percentage": 0,
      "_id": "5ffd6a986ae6f50436b89e02",
      "line_status_history": [],
      "data": [],
      "history": [
          {
           "_id": "5ffd6a986ae6f50436b89e03",
           "action": "Creating order",
           "action_datetime": "2021-01-12T09:23:36.662Z",
           "action_by": null,
           "channel_id": "5fa17deeb94953203f10f3d5",
           "channel_type": "Manufacturer API",
           "pre_status": "",
           "post_status": "Open"
           }
      ],
     "order_id": "Order001",
     "customer": "56b4586f4db4dea47f000006",
     "created_by": null,
     "gtin_id": "5ffcd0346ae6f50436b89de9",
     "ppn_id": null,
     "batch_id": "5ffd6a986ae6f50436b89e00",
     "line_id": "5ffd69ce6ae6f50436b89dfc",
     "update_datetime": "2021-01-12T09:23:36.664Z",
     "create_datetime": "2021-01-12T09:23:36.664Z",
     "__v": 0
   }
}