[go: up one dir, main page]

0% found this document useful (0 votes)
8 views2 pages

Locality Documentatie Api

The document provides a PHP script that uses cURL to make a GET request to the eMAG marketplace API for reading ZPL format data. It outlines the necessary parameters and filters for issuing an AWB, including locality IDs and courier account IDs. Additionally, it details the properties of localities and the constraints for filtering them in API requests.

Uploaded by

hkgn6g7yvq
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views2 pages

Locality Documentatie Api

The document provides a PHP script that uses cURL to make a GET request to the eMAG marketplace API for reading ZPL format data. It outlines the necessary parameters and filters for issuing an AWB, including locality IDs and courier account IDs. Additionally, it details the properties of localities and the constraints for filtering them in API requests.

Uploaded by

hkgn6g7yvq
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

<html>

Running...<br>
<?
$username = 'user';
$password = 'pass';
$hash = base64_encode($username . ':' . $password);
$headers = array(
'Authorization: Basic ' . $hash
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,'https://marketplace-api.emag.ro/awb/read_zpl?emag_id=9755945';
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
echo $result . "\n";
?>
</html>

Using this request will return a base64 encoded content of the ZPL format as in the example below

Resource Example Context

awb/read_zpl http method: POST


read_zpl response
example.txt

6.5. Counting Localities

In order to issue an AWB you need to submit the correct locality id. You can also use the id from the order.

The resource is locality and the available actions are read and count.

The following filters are available when counting localities:

Key Description Constraints

emag_id The locality with this id Integer

name All localities with this name String of length between 0 and 60

modified All localities modified after this date Date with the 'Y-m-d H:i:s' format

6.6. Reading Localities

The following filters are available when reading localities:

55
Key Description Constraints

emag_id The locality with this id Integer

name All localities with this name String of length between 0 and 60

region2 The name of the county for which you want String of length between 0 and 60
localities

country_code Country Alpha-2 code. Available values: String of length 0 and 60


RO – Romania
BG – Bulgaria
HU – Hungary
PL – Poland
EL – Greece
DE – Deutchland

modified All localities modified after this date Date with the 'Y-m-d H:i:s' format

itemsPerPage The maximum number of localities to return. Optional. Integer value between 1 and 100.

currentPage The page offset. Optional. Integer value between 1 and 65535.

When not using the country filter the API will respond only with localities from the platform country.

A locality has the following properties:

Key Description Constraints

emag_id The id of the locality Integer

name The name of the locality String of length between 0 and 60

name_latin The latin name of the locality String of length between 0 and 60

region([1-4]+) Region name String of length between 0 and 60

region([1-4]+)_latin Region name latin version String of length between 0 and 60

geoid Geographic id of the location Integer

modified Last modification date Date with the 'Y-m-d H:i:s' format

zipcode The zipcode of the locality String of length between 0 and 10

country_code Country Alpha-2 code String of length between 0 and 60

6.7. Reading courier accounts

In order to issue an AWB you need to submit the correct courier account id.

56

You might also like