-
ClientAuth - authorization
C#
var client =
new RestClient("https://dxwebapit.posta.hr:9000/api/authentication/client_auth");
client.Timeout = -1;
var request =
new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
var body = @"{
" + " " +
@" ""username"": ""test"",
" + " " +
@" ""password"": ""test""
" + " " +
@"}";
request.AddParameter("application/json", body, ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
JS
var settings
= {
"url": "https://dxwebapit.posta.hr:9000/api/authentication/client_auth",
"method": "POST",
"timeout": 0,
"headers": {
"Content-Type": "application/json"
},
"data": JSON.
stringify({
"username": "test",
"password": "test"
}),
};
$.ajax(settings).done(
function (response) {
console.
log(response);
});
PHP – cURL
<?php
$curl = curl_init();
curl_setopt_array($curl,
array(
CURLOPT_URL => 'https://dxwebapit.posta.hr:9000/api/authentication/client_auth',
CURLOPT_RETURNTRANSFER =>
true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION =>
true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"username": "test",
"password": "test"
}',
CURLOPT_HTTPHEADER =>
array(
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
-
CreateShipemntOrders
C#
var client =
new RestClient("https://dxwebapit.posta.hr:9020/api/shipment/create_shipment_orders");
client.Timeout = -1;
var request =
new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJDRUNPREUiOiI2NzU5ODQiLCJuYmYiOjE2Njk3MTM1MzQsImV4cCI6MTY2OTcyNzkzNCwiaWF0IjoxNjY5NzEzNTM0fQ.bilmFmhsbCADq8-GK7Apzrf35eyi3AMv0jiMZLLEgCI");
request.AddHeader("Content-Type", "application/json");
var body = @"{
" + " " +
@" ""parcels"": [
" + " " +
@"{
" + " " +
@"""client_reference_number"": ""test"",
" + " " +
@"""service"": ""26"",
" + " " +
@"""payed_by"": 1,
" + " " +
@"""delivery_type"": 1,
" + " " +
@"""value"": null,
" + " " +
@"""payment_value"": null,
" + " " +
@"""pickup_type"": 1,
" + " " +
@"""parcel_size"": ""L"",
" + " " +
@"""reference_field_B"": """",
" + " " +
@"""reference_field_C"": """",
" + " " +
@"""reference_field_D"": """",
" + " " +
@" ""sender"":
" + " " +
@" {
" + " " +
@" ""sender_name"": ""testNameSender"",
" + " " +
@" ""sender_phone"": ""+38598111111"",
" + " " +
@" ""sender_email"": ""test@test.com"",
" + " " +
@" ""sender_street"": ""testStreetSender"",
" + " " +
@" ""sender_hnum"": ""1"",
" + " " +
@" ""sender_hnum_suffix"": ""testHnumSuffixSender"",
" + " " +
@" ""sender_zip"": 10000,
" + " " +
@" ""sender_city"": ""Zagreb"",
" + " " +
@" ""sender_pickup_center"": null
" + " " +
@" },
" + " " +
@" ""recipient"":
" + " " +
@" {
" + " " +
@" ""recipient_name"": ""testNameRecipient"",
" + " " +
@" ""recipient_phone"": ""+385998274492"",
" + " " +
@" ""recipient_email"": ""test@test,com"",
" + " " +
@" ""recipient_street"": ""testStreetRecipient"",
" + " " +
@" ""recipient_hnum"": 2,
" + " " +
@" ""recipient_hnum_suffix"": ""testHnumSuffixRecipient"",
" + " " +
@" ""recipient_zip"": 10000,
" + " " +
@" ""recipient_city"": ""Zagreb"",
" + " " +
@" ""recipient_delivery_center"": null
" + " " +
@" },
" + " " +
@" ""additional_services"": [
" + " " +
@" {
" + " " +
@" ""additional_service_id"": 1
" + " " +
@" }
" + " " +
@" ],
" + " " +
@" ""packages"": [
" + " " +
@" {
" + " " +
@" ""barcode"": """",
" + " " +
@" ""barcode_type"": 1,
" + " " +
@" ""barcode_client"": ""test1"",
" + " " +
@" ""weight"": 3
" + " " +
@" },
" + " " +
@" {
" + " " +
@" ""barcode"": """",
" + " " +
@" ""barcode_type"": 1,
" + " " +
@" ""barcode_client"": ""test2"",
" + " " +
@" ""weight"": 3
" + " " +
@" }
" + " " +
@" ]
" + " " +
@"}
" + " " +
@"],
" + " " +
@" ""return_address_label"": true
" + " " +
@"}
" + " " +
@"
" + " " +
@"";
request.AddParameter("application/json", body, ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
JS
var settings
= {
"url": "https://dxwebapit.posta.hr:9020/api/shipment/create_shipment_orders",
"method": "POST",
"timeout": 0,
"headers": {
"Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJDRUNPREUiOiI2NzU5ODQiLCJuYmYiOjE2Njk3MTM1MzQsImV4cCI6MTY2OTcyNzkzNCwiaWF0IjoxNjY5NzEzNTM0fQ.bilmFmhsbCADq8-GK7Apzrf35eyi3AMv0jiMZLLEgCI",
"Content-Type": "application/json"
},
"data": JSON.
stringify({
"parcels": [
{
"client_reference_number": "test",
"service": "26",
"payed_by": 1,
"delivery_type": 1,
"value":
null,
"payment_value":
null,
"pickup_type": 1,
"parcel_size": "L",
"reference_field_B": "",
"reference_field_C": "",
"reference_field_D": "",
"sender": {
"sender_name": "testNameSender",
"sender_phone": "+38598111111",
"sender_email": "test@test.com",
"sender_street": "testStreetSender",
"sender_hnum": "1",
"sender_hnum_suffix": "testHnumSuffixSender",
"sender_zip": 10000,
"sender_city": "Zagreb",
"sender_pickup_center":
null
},
"recipient": {
"recipient_name": "testNameRecipient",
"recipient_phone": "+385998274492",
"recipient_email": "test@test,com",
"recipient_street": "testStreetRecipient",
"recipient_hnum": 2,
"recipient_hnum_suffix": "testHnumSuffixRecipient",
"recipient_zip": 10000,
"recipient_city": "Zagreb",
"recipient_delivery_center":
null
},
"additional_services": [
{
"additional_service_id": 1
}
],
"packages": [
{
"barcode": "",
"barcode_type": 1,
"barcode_client": "test1",
"weight": 3
},
{
"barcode": "",
"barcode_type": 1,
"barcode_client": "test2",
"weight": 3
}
]
}
],
"return_address_label":
true
}),
};
$.ajax(settings).done(
function (response) {
console.
log(response);
});
PHP – cURL
<?php
$curl = curl_init();
curl_setopt_array($curl,
array(
CURLOPT_URL => 'https://dxwebapit.posta.hr:9020/api/shipment/create_shipment_orders',
CURLOPT_RETURNTRANSFER =>
true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION =>
true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"parcels": [
{
"client_reference_number": "test",
"service": "26",
"payed_by": 1,
"delivery_type": 1,
"value": null,
"payment_value": null,
"pickup_type": 1,
"parcel_size": "L",
"reference_field_B": "",
"reference_field_C": "",
"reference_field_D": "",
"sender":
{
"sender_name": "testNameSender",
"sender_phone": "+38598111111",
"sender_email": "test@test.com",
"sender_street": "testStreetSender",
"sender_hnum": "1",
"sender_hnum_suffix": "testHnumSuffixSender",
"sender_zip": 10000,
"sender_city": "Zagreb",
"sender_pickup_center": null
},
"recipient":
{
"recipient_name": "testNameRecipient",
"recipient_phone": "+385998274492",
"recipient_email": "test@test,com",
"recipient_street": "testStreetRecipient",
"recipient_hnum": 2,
"recipient_hnum_suffix": "testHnumSuffixRecipient",
"recipient_zip": 10000,
"recipient_city": "Zagreb",
"recipient_delivery_center": null
},
"additional_services": [
{
"additional_service_id": 1
}
],
"packages": [
{
"barcode": "",
"barcode_type": 1,
"barcode_client": "test1",
"weight": 3
},
{
"barcode": "",
"barcode_type": 1,
"barcode_client": "test2",
"weight": 3
}
]
}
],
"return_address_label": true
}
',
CURLOPT_HTTPHEADER =>
array(
'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJDRUNPREUiOiI2NzU5ODQiLCJuYmYiOjE2Njk3MTM1MzQsImV4cCI6MTY2OTcyNzkzNCwiaWF0IjoxNjY5NzEzNTM0fQ.bilmFmhsbCADq8-GK7Apzrf35eyi3AMv0jiMZLLEgCI',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
-
CancelShipmentOrders
C#
var client =
new RestClient("https://dxwebapit.posta.hr:9020/api/shipment/cancel_shipment_orders");
client.Timeout = -1;
var request =
new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJDRUNPREUiOiI2NzU5ODQiLCJuYmYiOjE2Njk3MTkyMTYsImV4cCI6MTY2OTczMzYxNiwiaWF0IjoxNjY5NzE5MjE2fQ.sHoK1KLYqbM--QjxqDJ_0rcD0njgYUWo4rraBIdDbyM");
request.AddHeader("Content-Type", "application/json");
var body = @"{
" + " " +
@" ""parcels"": [
" + " " +
@" {
" + " " +
@" ""client_reference_number"": ""test1""
" + " " +
@" },
" + " " +
@" {
" + " " +
@" ""client_reference_number"": ""test2""
" + " " +
@" }
" + " " +
@"
" + " " +
@" ]
" + " " +
@"}
" + " " +
@"";
request.AddParameter("application/json", body, ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
JS
var settings
= {
"url": "https://dxwebapit.posta.hr:9020/api/shipment/cancel_shipment_orders",
"method": "POST",
"timeout": 0,
"headers": {
"Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJDRUNPREUiOiI2NzU5ODQiLCJuYmYiOjE2Njk3MTkyMTYsImV4cCI6MTY2OTczMzYxNiwiaWF0IjoxNjY5NzE5MjE2fQ.sHoK1KLYqbM--QjxqDJ_0rcD0njgYUWo4rraBIdDbyM",
"Content-Type": "application/json"
},
"data": JSON.
stringify({
"parcels": [
{
"client_reference_number": "test1"
},
{
"client_reference_number": "test2"
}
]
}),
};
$.ajax(settings).done(
function (response) {
console.
log(response);
});
PHP – cURL
<?php
$curl = curl_init();
curl_setopt_array($curl,
array(
CURLOPT_URL => 'https://dxwebapit.posta.hr:9020/api/shipment/cancel_shipment_orders',
CURLOPT_RETURNTRANSFER =>
true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION =>
true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"parcels": [
{
"client_reference_number": "test1"
},
{
"client_reference_number": "test2"
}
]
}
',
CURLOPT_HTTPHEADER =>
array(
'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJDRUNPREUiOiI2NzU5ODQiLCJuYmYiOjE2Njk3MTkyMTYsImV4cCI6MTY2OTczMzYxNiwiaWF0IjoxNjY5NzE5MjE2fQ.sHoK1KLYqbM--QjxqDJ_0rcD0njgYUWo4rraBIdDbyM',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
-
GetShipmentStatus
C#
var client =
new RestClient("https://dxwebapit.posta.hr:9020/api/shipment/get_shipment_status");
client.Timeout = -1;
var request =
new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJDRUNPREUiOiI2NzU5ODQiLCJuYmYiOjE2NjkwMjkwMzQsImV4cCI6MTY2OTA0MzQzNCwiaWF0IjoxNjY5MDI5MDM0fQ.G1bC0hsBhtoub5uhk-lszDjT3Sb8SF1wmZ3dRLvnlHo");
request.AddHeader("Content-Type", "application/json");
var body = @"{ ""barcodes"": [
" + " " +
@" {
" + " " +
@" ""barcode"": ""LE347087966HR""
" + " " +
@" },
" + " " +
@" {
" + " " +
@" ""barcode"": ""LE347087952HR""
" + " " +
@" }
" + " " +
@"
" + " " +
@" ]
" + " " +
@"}
" + " " +
@"";
request.AddParameter("application/json", body, ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
JS
var settings
= {
"url": "https://dxwebapit.posta.hr:9020/api/shipment/get_shipment_status",
"method": "GET",
"timeout": 0,
"headers": {
"Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJDRUNPREUiOiI2NzU5ODQiLCJuYmYiOjE2NjkwMjkwMzQsImV4cCI6MTY2OTA0MzQzNCwiaWF0IjoxNjY5MDI5MDM0fQ.G1bC0hsBhtoub5uhk-lszDjT3Sb8SF1wmZ3dRLvnlHo",
"Content-Type": "application/json"
},
"data": JSON.
stringify({
"barcodes": [
{
"barcode": "LE347087966HR"
},
{
"barcode": "LE347087952HR"
}
]
}),
};
$.ajax(settings).done(
function (response) {
console.
log(response);
});
PHP – cURL
<?php
$curl = curl_init();
curl_setopt_array($curl,
array(
CURLOPT_URL => 'https://dxwebapit.posta.hr:9020/api/shipment/get_shipment_status',
CURLOPT_RETURNTRANSFER =>
true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION =>
true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_POSTFIELDS =>'{ "barcodes": [
{
"barcode": "LE347087966HR"
},
{
"barcode": "LE347087952HR"
}
]
}
',
CURLOPT_HTTPHEADER =>
array(
'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJDRUNPREUiOiI2NzU5ODQiLCJuYmYiOjE2NjkwMjkwMzQsImV4cCI6MTY2OTA0MzQzNCwiaWF0IjoxNjY5MDI5MDM0fQ.G1bC0hsBhtoub5uhk-lszDjT3Sb8SF1wmZ3dRLvnlHo',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
-
GetShippingLabels
C#
var client =
new RestClient("https://dxwebapit.posta.hr:9020/api/shipment/get_shipping_labels");
client.Timeout = -1;
var request =
new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJDRUNPREUiOiI2NzU5ODQiLCJuYmYiOjE2NjkxOTQ2MTQsImV4cCI6MTY2OTIwOTAxNCwiaWF0IjoxNjY5MTk0NjE0fQ.CZF54o_51Qq4WT-fQ8jDCDQbNIMZRHe26JBV41s9uyI");
request.AddHeader("Content-Type", "application/json");
var body = @"{
" + " " +
@"""client_reference_number"": ""250797204153-R-000124894291002"",
" + " " +
@"""barcodes"": [
" + " " +
@" {
" + " " +
@" ""barcode"": ""LE900001297HR""
" + " " +
@" },
" + " " +
@" {
" + " " +
@" ""barcode"": ""LE900001310HR""
" + " " +
@" }
" + " " +
@" ],
" + " " +
@"""A4"":false
" + " " +
@"}
" + " " +
@"";
request.AddParameter("application/json", body, ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
JS
var settings
= {
"url": "https://dxwebapit.posta.hr:9020/api/shipment/get_shipping_labels",
"method": "GET",
"timeout": 0,
"headers": {
"Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJDRUNPREUiOiI2NzU5ODQiLCJuYmYiOjE2NjkxOTQ2MTQsImV4cCI6MTY2OTIwOTAxNCwiaWF0IjoxNjY5MTk0NjE0fQ.CZF54o_51Qq4WT-fQ8jDCDQbNIMZRHe26JBV41s9uyI",
"Content-Type": "application/json"
},
"data": JSON.
stringify({
"client_reference_number": "250797204153-R-000124894291002",
"barcodes": [
{
"barcode": "LE900001297HR"
},
{
"barcode": "LE900001310HR"
}
],
"A4":
false
}),
};
$.ajax(settings).done(
function (response) {
console.
log(response);
});
PHP – cURL
<?php
$curl = curl_init();
curl_setopt_array($curl,
array(
CURLOPT_URL => 'https://dxwebapit.posta.hr:9020/api/shipment/get_shipping_labels',
CURLOPT_RETURNTRANSFER =>
true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION =>
true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_POSTFIELDS =>'{
"client_reference_number": "250797204153-R-000124894291002",
"barcodes": [
{
"barcode": "LE900001297HR"
},
{
"barcode": "LE900001310HR"
}
],
"A4":false
}
',
CURLOPT_HTTPHEADER =>
array(
'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJDRUNPREUiOiI2NzU5ODQiLCJuYmYiOjE2NjkxOTQ2MTQsImV4cCI6MTY2OTIwOTAxNCwiaWF0IjoxNjY5MTk0NjE0fQ.CZF54o_51Qq4WT-fQ8jDCDQbNIMZRHe26JBV41s9uyI',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
-
GetParcelDeliveryPoint
C#
var client =
new RestClient("https://dxwebapit.posta.hr:9020/api/delivery_point/get_parcel_delivery_point");
client.Timeout = -1;
var request =
new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJDRUNPREUiOiI2NzU5ODQiLCJuYmYiOjE2Njk3MTkyMTYsImV4cCI6MTY2OTczMzYxNiwiaWF0IjoxNjY5NzE5MjE2fQ.sHoK1KLYqbM--QjxqDJ_0rcD0njgYUWo4rraBIdDbyM");
request.AddHeader("Content-Type", "application/json");
var body = @"{
" + " " +
@"""facilityType"": ""PAK"",
" + " " +
@"""nextWeek"": 0,
" + " " +
@"""searchText"": ""62102""
" + " " +
@"}";
request.AddParameter("application/json", body, ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
JS
var settings
= {
"url": "https://dxwebapit.posta.hr:9020/api/delivery_point/get_parcel_delivery_point",
"method": "GET",
"timeout": 0,
"headers": {
"Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJDRUNPREUiOiI2NzU5ODQiLCJuYmYiOjE2Njk3MTkyMTYsImV4cCI6MTY2OTczMzYxNiwiaWF0IjoxNjY5NzE5MjE2fQ.sHoK1KLYqbM--QjxqDJ_0rcD0njgYUWo4rraBIdDbyM",
"Content-Type": "application/json"
},
"data": JSON.
stringify({
"facilityType": "PAK",
"nextWeek": 0,
"searchText": "62102"
}),
};
$.ajax(settings).done(
function (response) {
console.
log(response);
});
PHP – cURL
<?php
$curl = curl_init();
curl_setopt_array($curl,
array(
CURLOPT_URL => 'https://dxwebapit.posta.hr:9020/api/delivery_point/get_parcel_delivery_point',
CURLOPT_RETURNTRANSFER =>
true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION =>
true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_POSTFIELDS =>'{
"facilityType": "PAK",
"nextWeek": 0,
"searchText": "62102"
}',
CURLOPT_HTTPHEADER =>
array(
'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJDRUNPREUiOiI2NzU5ODQiLCJuYmYiOjE2Njk3MTkyMTYsImV4cCI6MTY2OTczMzYxNiwiaWF0IjoxNjY5NzE5MjE2fQ.sHoK1KLYqbM--QjxqDJ_0rcD0njgYUWo4rraBIdDbyM',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;