// install dependency
// $ composer require guzzlehttp/guzzle
<?php
require_once('vendor/autoload.php');
$client = new \GuzzleHttp\Client();
$transaction = [
"type" => "DISPATCH_INSTRUCTION_RESPONSE",
"content" => [
"header" => [
"orderId" => null,
"orderDate" => null,
"shipmentId" => "48148",
"shippingNoticeIdentifier" => "SHIPMENT-123",
"shippingNoticeDate" => "2022-10-12T12:53:51.000000Z",
"dispatchInstructionResponseDate" => "2022-10-12T12:53:51.000000Z",
"responseDate" => "2022-10-12T12:53:51.000000Z",
"shipmentDate" => "2022-10-12T12:53:51.000000Z",
"requestedDeliveryDate" => "2022-10-11T22:00:00.000000Z",
"expectedDeliveryDate" => "2022-10-11T22:00:00.000000Z",
"shipFrom" => [
"name" => "Foo GmbH",
"identifiers" => [
[
"domain" => "GS1",
"identifier" => "GS1",
],
],
"postalAddress" => [
"name" => "Foo",
"street" => "Musterstraße 123",
"addressExtra" => "1st Floor",
"city" => "Hamburg",
"postalCode" => "12345",
"state" => "HH",
"countryCode" => "DE",
],
"contacts" => [
[
"title" => "Dr.",
"salutation" => "Herr",
"firstName" => "Max",
"lastName" => "Muster",
"phone" => "+49 12345",
"mobile" => "+49 12345",
"email" => "[email protected]",
"fax" => "+49 12345",
],
],
],
"shipTo" => [
"name" => "Foo GmbH",
"identifiers" => [
[
"domain" => "GS1",
"identifier" => "GS1",
],
],
"postalAddress" => [
"name" => "Foo",
"street" => "Musterstraße 123",
"addressExtra" => "1st Floor",
"city" => "Hamburg",
"postalCode" => "12345",
"state" => "HH",
"countryCode" => "DE",
],
"contacts" => [
[
"title" => "Dr.",
"salutation" => "Herr",
"firstName" => "Max",
"lastName" => "Muster",
"phone" => "+49 12345",
"mobile" => "+49 12345",
"email" => "[email protected]",
"fax" => "+49 12345",
],
],
],
"billTo" => [
"name" => "Foo GmbH",
"identifiers" => [
[
"domain" => "GS1",
"identifier" => "GS1",
],
],
"postalAddress" => [
"name" => "Foo",
"street" => "Musterstraße 123",
"addressExtra" => "1st Floor",
"city" => "Hamburg",
"postalCode" => "12345",
"state" => "HH",
"countryCode" => "DE",
],
"contacts" => [
[
"title" => "Dr.",
"salutation" => "Herr",
"firstName" => "Max",
"lastName" => "Muster",
"phone" => "+49 12345",
"mobile" => "+49 12345",
"email" => "[email protected]",
"fax" => "+49 12345",
],
],
],
"buyer" => [
"name" => "Foo GmbH",
"identifiers" => [
[
"domain" => "GS1",
"identifier" => "GS1",
],
],
"postalAddress" => [
"name" => "Foo",
"street" => "Musterstraße 123",
"addressExtra" => "1st Floor",
"city" => "Hamburg",
"postalCode" => "12345",
"state" => "HH",
"countryCode" => "DE",
],
"contacts" => [
[
"title" => "Dr.",
"salutation" => "Herr",
"firstName" => "Max",
"lastName" => "Muster",
"phone" => "+49 12345",
"mobile" => "+49 12345",
"email" => "[email protected]",
"fax" => "+49 12345",
],
],
],
"supplier" => [
"name" => "Foo GmbH",
"identifiers" => [
[
"domain" => "GS1",
"identifier" => "GS1",
],
],
"postalAddress" => [
"name" => "Foo",
"street" => "Musterstraße 123",
"addressExtra" => "1st Floor",
"city" => "Hamburg",
"postalCode" => "12345",
"state" => "HH",
"countryCode" => "DE",
],
"contacts" => [
[
"title" => "Dr.",
"salutation" => "Herr",
"firstName" => "Max",
"lastName" => "Muster",
"phone" => "+49 12345",
"mobile" => "+49 12345",
"email" => "[email protected]",
"fax" => "+49 12345",
],
],
],
"comments" => null,
],
"transportUnits" => [
[
"unitIdentifier" => "342601560208144493",
"unitType" => null,
"containedTradeUnitCount" => null,
"items" => [
[
"lineNumber" => 4,
"shippingNoticeLineNumber" => 1,
"shippedQuantity" => 1,
"orderedQuantity" => 1,
"isDepositItem" => false,
"identifiers" => [
[
"domain" => "GS1",
"identifier" => "abc",
],
],
"unitOfMeasure" => "EA",
"unitPrice" => null,
"currency" => null,
"description" => "",
"batches" => [
[
"batchIdentifier" => "abc",
"expirationDate" => "2022-12-31",
"quantity" => 30,
],
],
"parentLineNumber" => null,
"openQuantityAction" => null,
],
],
],
],
],
];
$response = $client->request('POST', 'https://api.procuros.io/v2/transactions', [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer <your-api-token>',
],
'json' => $transaction,
]);