Quick Start
In this guide, we will go through the process of setting up an API connection, and a few basic endpoints that you can use for EDI document management.
We will use PHP as the example language but you can translate the examples to any programming language you desire.
Table of Contents
Connecting to the API
We assume for this PHP example that Guzzle
is installed and available to the script.
$client = new \GuzzleHttp\Client();
$response = $client->request('GET', '<your-desired-endpoint>', [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer <your-api-token>',
],
]);
Listing Documents
Following on from this, you can use the connection to list orders from your trade partners.
$response = $client->request('GET', 'https://api.procuros.io/v2/transactions', [
'headers' => $headers,
]);
$body = json_decode((string) $response->getBody());
$items = $body->items;
All types of documents are returned from this API call. In order to filter for a specific type, you may pass the filter
URL parameter. For example:
$response = $client->request('GET', 'https://api.procuros.io/v2/transactions?filter[type]=ORDER', [
'headers' => $headers,
]);
For a list of all available parameters, please see the List Incoming Transactions API reference.
Sending Documents
Similar to listing documents, you can use the connection to send documents to your trade partners.
$transaction = [
"type": "ORDER",
"content": [
"header": [
"orderIdentifier": "bestellung-20231203-001",
"orderDate": "2023-12-03",
"currency": "EUR",
"requestedDeliveryDate": "2023-12-06",
"buyer": ["identifiers": [["domain": "GS1", "identifier": "3220010000001" ]]],
"supplier": ["identifiers": [["domain": "GS1", "identifier": "3220010000013" ]]],
"billTo": ["identifiers": [["domain": "GS1", "identifier": "3220010000001" ]]],
"shipTo": ["identifiers": [["domain": "GS1", "identifier": "3220010000003" ]]],
],
"items": [
[
"identifiers": [["domain": "GS1", "identifier": "2330000000007" ]],
"lineNumber": 1,
"quantity": 10,
"isDepositItem": false,
"unitOfMeasure": "EA",
"description": "A description of the item",
"requestedDeliveryDate": null,
"unitPrice": 1.23
]
]
]
];
$client->request('POST', 'https://api.procuros.io/v2/transactions', [
'headers' => $headers,
'json' => $transaction,
]);
For a list of all available document types that can be created, as well as the JSON body format for each, please see the Send Transaction API reference.
Updated about 2 years ago