Articles in this section

Batch Import using API

Endpoint

We have an API Gateway endpoint, that accepts the batch data. Our standard endpoint, located at batch-import.factbird.com (for Private Cloud installations, the endpoint is batch-import.<tenant>.factbird.com)

  • URL: https://batch-import.factbird.com/<filename>.xml (<filename> should be changed out with a unique filename)
  • Method: POST
  • Body: XML content
  • Port: 443 (just standard SSL/TLS)
  • Batch Import key: xxxxxxXXXXXXXxxxxxxxXXXXXXxxxxxxx
  • Headers (contains the Batch Import key):
    • Content-Type: application/xml
    • x-api-key: xxxxxxXXXXXXXxxxxxxxXXXXXXxxxxxxx

Example cURL call:

curl -X POST -H "Content-Type: application/xml" \\
     -H 'x-api-key: xxxxxxXXXXXXXxxxxxxxXXXXXXxxxxxxx' \\
     '<https://batch-import.factbird.com/test-file.xml>' \\
     -d '<batch><product>....</batch>' # XML contents here

The above call will send the XML data to our API Gateway endpoint, which will validate the Batch Import key

The following parts should change according to your need:

  • test-file.xml to a unique filename
  • the value in x-api-key with your Batch Import key
  • the data in '<batch><product>....</batch>' with your actual batch XML data
<?xml version="1.0" encoding="UTF-8"?>
<batch>
<product>
<!-- If not relevant, create a static packaging and put it here -->
<packaging>
<packagingExternalId>Generic</packagingExternalId> <!-- Used to match packaging -->
<packagingName>Pcs</packagingName>
<packagingUnit>pcs</packagingUnit>
<packagingComment/>
</packaging>
<productExternalId>000000000000103262</productExternalId> <!-- The product SKU/number, used to match product -->
<productName>Magic Pill 10 MG BLIST 14 TAB DRY TEST</productName>
<validatedSpeed>200</validatedSpeed> <!-- Optional -->
<expectedLineSpeed>150</expectedLineSpeed> <!-- Optional -->
<multiplier>1</multiplier>
</product>
<externalLineId>640-6-1</externalLineId> <!-- ID of the line (you can find this in Factbird under Administration -> Line -> Identifier) -->
<batchNumber>000001005302</batchNumber> <!-- The batch/PO number, Used to match batch -->
<plannedStart>2019-03-19T11:38:48.000Z</plannedStart> <!-- Optional time as ISO string -->
<actualStart>2019-05-13T08:38:00.000Z</actualStart> <!-- Optional time as ISO string -->
<actualStop>2019-05-13T08:38:00.000Z</actualStop> <!-- Optional time as ISO string -->
<plannedAmount>10</plannedAmount>
<comment>Batch comment</comment> <!-- Optional -->
</batch>
<?xml version="1.0" encoding="UTF-8"?>
<batches>
<batch>
...
</batch>
</batches>

Notes

  • The externalLineId is used to map which line the batch is on. If you’d like IDs that are easier to read, you can ask us to set up custom identifiers for your line. You can then use that custom identifier instead of the line ID from Administration. Please contact support@factbird.com if this could be of interest to you.
  • productExternalId is used to find a matching product
    • It will be created if none are found
  • packagingExternalId is used to find a matching packaging
    • It will be created if none are found
  • batchNumber is used to find a matching batch
    • It will be created if none are found
  • To start or stop the batch, simply add a value for the optional actualStart and actualStop fields.
  • XML tags are case sensitive. As a rule of thumb, Factbird always uses "camelCase". See https://en.wikipedia.org/wiki/Camel_case

Was this article helpful?
0 out of 0 found this helpful