Savienojieties ar publisko GraphQL un organizācijas API atslēgu. Šī lapa aptver katru publisko operāciju ar kopēšanas piemēriem.
Sūtiet POST pieprasījumus uz publisko GraphQL galapunktu ar organizācijas API atslēgu. Pēc reģistrācijas izveidojiet testa vai live atslēgu administrācijā.
Galapunkts
POST http://localhost:4000/graphqlAuthorization galvene
Authorization: Bearer ps_test_YOUR_KEYTEST režīms izmanto Unisend, Pasts un DPD testa akreditācijas datus. LIVE režīms izmanto live datus. Ja to nav, tiek izmantoti fiktīvie dati. Stripe norēķini darbojas tikai LIVE.
Tipiska veikala kase: iegūstiet piegādes opcijas zināmam izmēram, izvēlieties tuvākos automātus, saglabājiet melnrakstu ar tālruņiem un veikala pasūtījuma id, pēc iepakošanas atrodiet to, iegādājieties etiķeti, lejupielādējiet PDF un pēc vajadzības izveidojiet atgriešanas etiķeti.
GraphQL
query ShippingOptions($lengthMm: Int, $widthMm: Int, $heightMm: Int, $weightGrams: Int, $originCountry: CountryCode, $destinationCountry: CountryCode) {
shippingOptions(lengthMm: $lengthMm, widthMm: $widthMm, heightMm: $heightMm, weightGrams: $weightGrams, originCountry: $originCountry, destinationCountry: $destinationCountry) {
providerId
sizeCode
methods
countries
displayRate { cents currency }
}
}
query SearchStations($countryCode: CountryCode!, $providerId: ProviderId, $latitude: Float, $longitude: Float) {
searchStations(countryCode: $countryCode, providerId: $providerId, latitude: $latitude, longitude: $longitude) {
id
name
line1
city
distanceMeters
}
}
mutation CreateDraftLabel(
$orderId: String!
$providerId: ProviderId!
$method: ShipmentMethod!
$originCountry: CountryCode!
$destinationCountry: CountryCode!
$weightGrams: Int
$senderName: String!
$senderLine1: String!
$senderCity: String!
$senderPostalCode: String!
$senderPhone: String!
$recipientName: String!
$recipientLine1: String!
$recipientCity: String!
$recipientPostalCode: String!
$recipientPhone: String!
$sizeCode: SizeCode
$stationId: String
) {
createDraftLabel(
orderId: $orderId
providerId: $providerId
method: $method
originCountry: $originCountry
destinationCountry: $destinationCountry
weightGrams: $weightGrams
senderName: $senderName
senderLine1: $senderLine1
senderCity: $senderCity
senderPostalCode: $senderPostalCode
senderPhone: $senderPhone
recipientName: $recipientName
recipientLine1: $recipientLine1
recipientCity: $recipientCity
recipientPostalCode: $recipientPostalCode
recipientPhone: $recipientPhone
sizeCode: $sizeCode
stationId: $stationId
) {
id
status
providerId
sizeCode
originCountry
destinationCountry
method
orderId
stationId
parentLabelId
returnLabelId
}
}
query Labels($orderId: String, $status: LabelStatus) {
labels(orderId: $orderId, status: $status) {
id
status
orderId
stationId
}
}
mutation PurchaseLabel($id: String!, $sizeCode: SizeCode, $weightGrams: Int) {
purchaseLabel(id: $id, sizeCode: $sizeCode, weightGrams: $weightGrams) {
id
status
sizeCode
weightGrams
trackingCode
trackingUrl
}
}
query DownloadLabelPdf($id: String!) {
downloadLabelPdf(id: $id)
}
mutation CreateReturnLabel($id: String!) {
createReturnLabel(id: $id) {
id
parentLabelId
trackingCode
trackingUrl
}
}Jūsu organizācijai iespējotie piegādātāji ar metodēm, galamērķa valstīm, kurjera sizeCodes un “no” parādāmo tarifu lētākajam piedāvātajam izmēram plus jūsu uzcenojums. Padodiet originCountry (sūtītāja valsts; pēc noklusējuma organizācijas sūtītājs vai LV). destinationRates ir lētākais izmērs katrā izcelsme → galamērķis joslā. Kasē izmantojiet shippingOptions.
GraphQL
query Catalog($originCountry: CountryCode) {
catalog(originCountry: $originCountry) {
providerId
methods
countries
sizeCodes
displayRate {
cents
currency
}
destinationRates {
destinationCountry
displayRate {
cents
currency
}
}
}
}curl
curl -sS http://localhost:4000/graphql \
-H 'content-type: application/json' \
-H 'authorization: Bearer ps_test_YOUR_KEY' \
-d '{
"query": "query Catalog($originCountry: CountryCode) {\n catalog(originCountry: $originCountry) {\n providerId\n methods\n countries\n sizeCodes\n displayRate {\n cents\n currency\n }\n destinationRates {\n destinationCountry\n displayRate {\n cents\n currency\n }\n }\n }\n}",
"variables": {
"originCountry": "LV"
}
}'Izvēlieties izmēra enum pēc izmēriem un svara vai apstipriniet jau izvēlētu izmēru. Padodiet providerId un vai nu sizeCode, vai length/width/height milimetros un weightGrams.
Tipiskie kļūdu kodi: VALIDATION, SIZE_DOES_NOT_FIT, SIZE_NOT_OFFERED
GraphQL
query RecommendSize(
$providerId: ProviderId!
$sizeCode: SizeCode
$lengthMm: Int
$widthMm: Int
$heightMm: Int
$weightGrams: Int
) {
recommendSize(
providerId: $providerId
sizeCode: $sizeCode
lengthMm: $lengthMm
widthMm: $widthMm
heightMm: $heightMm
weightGrams: $weightGrams
)
}curl
curl -sS http://localhost:4000/graphql \
-H 'content-type: application/json' \
-H 'authorization: Bearer ps_test_YOUR_KEY' \
-d '{
"query": "query RecommendSize(\n $providerId: ProviderId!\n $sizeCode: SizeCode\n $lengthMm: Int\n $widthMm: Int\n $heightMm: Int\n $weightGrams: Int\n) {\n recommendSize(\n providerId: $providerId\n sizeCode: $sizeCode\n lengthMm: $lengthMm\n widthMm: $widthMm\n heightMm: $heightMm\n weightGrams: $weightGrams\n )\n}",
"variables": {
"providerId": "UNISEND",
"lengthMm": 200,
"widthMm": 150,
"heightMm": 80,
"weightGrams": 500
}
}'Kases piedāvājums: nosūtiet izmēra enum vai izmērus un svaru, plus originCountry un destinationCountry (LV, EE vai LT). Atgriež iespējotos piegādātājus, kas var nosūtīt šo joslu, atrisināto sizeCode un parādāmo tarifu (bāze pēc joslas izmēra plus jūsu uzcenojums). Ja destinationCountry izlaižat, katram iespējotajam galamērķim ir viena opcija. Piegādātāji, kas izmēru neņem, tiek izlaisti.
Tipiskie kļūdu kodi: VALIDATION
GraphQL
query ShippingOptions(
$sizeCode: SizeCode
$lengthMm: Int
$widthMm: Int
$heightMm: Int
$weightGrams: Int
$originCountry: CountryCode
$destinationCountry: CountryCode
) {
shippingOptions(
sizeCode: $sizeCode
lengthMm: $lengthMm
widthMm: $widthMm
heightMm: $heightMm
weightGrams: $weightGrams
originCountry: $originCountry
destinationCountry: $destinationCountry
) {
providerId
sizeCode
methods
countries
displayRate {
cents
currency
}
}
}curl
curl -sS http://localhost:4000/graphql \
-H 'content-type: application/json' \
-H 'authorization: Bearer ps_test_YOUR_KEY' \
-d '{
"query": "query ShippingOptions(\n $sizeCode: SizeCode\n $lengthMm: Int\n $widthMm: Int\n $heightMm: Int\n $weightGrams: Int\n $originCountry: CountryCode\n $destinationCountry: CountryCode\n) {\n shippingOptions(\n sizeCode: $sizeCode\n lengthMm: $lengthMm\n widthMm: $widthMm\n heightMm: $heightMm\n weightGrams: $weightGrams\n originCountry: $originCountry\n destinationCountry: $destinationCountry\n ) {\n providerId\n sizeCode\n methods\n countries\n displayRate {\n cents\n currency\n }\n }\n}",
"variables": {
"lengthMm": 200,
"widthMm": 150,
"heightMm": 80,
"weightGrams": 500,
"originCountry": "LV",
"destinationCountry": "LT"
}
}'Rezervējiet, kas, kur un kurā automātā, nepirkot etiķeti no kurjera. Statuss ir DRAFT. orderId ir obligāts (jūsu veikala pasūtījuma id). Tās pašas adreses un tālruņu lauki kā createLabel. sizeCode, izmēri un weightGrams ir neobligāti — izlaidiet tos un nodalījumu un svaru izvēlieties purchaseLabel. stationId ir galamērķa automāts no searchStations — izlaidiet to terminālis-uz-mājām (T2H) piegādei. PDF, izsekošana un Stripe maksa parādās tikai pēc purchaseLabel.
Tipiskie kļūdu kodi: VALIDATION, SIZE_DOES_NOT_FIT, SIZE_NOT_OFFERED, COUNTRY_NOT_SUPPORTED
GraphQL
mutation CreateDraftLabel(
$orderId: String!
$providerId: ProviderId!
$method: ShipmentMethod!
$originCountry: CountryCode!
$destinationCountry: CountryCode!
$weightGrams: Int
$senderName: String!
$senderLine1: String!
$senderCity: String!
$senderPostalCode: String!
$senderPhone: String!
$recipientName: String!
$recipientLine1: String!
$recipientCity: String!
$recipientPostalCode: String!
$recipientPhone: String!
$sizeCode: SizeCode
$stationId: String
$lengthMm: Int
$widthMm: Int
$heightMm: Int
) {
createDraftLabel(
orderId: $orderId
providerId: $providerId
method: $method
originCountry: $originCountry
destinationCountry: $destinationCountry
weightGrams: $weightGrams
senderName: $senderName
senderLine1: $senderLine1
senderCity: $senderCity
senderPostalCode: $senderPostalCode
senderPhone: $senderPhone
recipientName: $recipientName
recipientLine1: $recipientLine1
recipientCity: $recipientCity
recipientPostalCode: $recipientPostalCode
recipientPhone: $recipientPhone
sizeCode: $sizeCode
stationId: $stationId
lengthMm: $lengthMm
widthMm: $widthMm
heightMm: $heightMm
) {
id
status
providerId
sizeCode
originCountry
destinationCountry
method
orderId
stationId
weightGrams
trackingCode
trackingUrl
parentLabelId
returnLabelId
}
}curl
curl -sS http://localhost:4000/graphql \
-H 'content-type: application/json' \
-H 'authorization: Bearer ps_test_YOUR_KEY' \
-d '{
"query": "mutation CreateDraftLabel(\n $orderId: String!\n $providerId: ProviderId!\n $method: ShipmentMethod!\n $originCountry: CountryCode!\n $destinationCountry: CountryCode!\n $weightGrams: Int\n $senderName: String!\n $senderLine1: String!\n $senderCity: String!\n $senderPostalCode: String!\n $senderPhone: String!\n $recipientName: String!\n $recipientLine1: String!\n $recipientCity: String!\n $recipientPostalCode: String!\n $recipientPhone: String!\n $sizeCode: SizeCode\n $stationId: String\n $lengthMm: Int\n $widthMm: Int\n $heightMm: Int\n) {\n createDraftLabel(\n orderId: $orderId\n providerId: $providerId\n method: $method\n originCountry: $originCountry\n destinationCountry: $destinationCountry\n weightGrams: $weightGrams\n senderName: $senderName\n senderLine1: $senderLine1\n senderCity: $senderCity\n senderPostalCode: $senderPostalCode\n senderPhone: $senderPhone\n recipientName: $recipientName\n recipientLine1: $recipientLine1\n recipientCity: $recipientCity\n recipientPostalCode: $recipientPostalCode\n recipientPhone: $recipientPhone\n sizeCode: $sizeCode\n stationId: $stationId\n lengthMm: $lengthMm\n widthMm: $widthMm\n heightMm: $heightMm\n ) {\n id\n status\n providerId\n sizeCode\n originCountry\n destinationCountry\n method\n orderId\n stationId\n weightGrams\n trackingCode\n trackingUrl\n parentLabelId\n returnLabelId\n }\n}",
"variables": {
"orderId": "ORD-1001",
"providerId": "UNISEND",
"method": "STATION_DROPOFF",
"originCountry": "LV",
"destinationCountry": "LT",
"senderName": "Acme SIA",
"senderLine1": "Brivibas iela 1",
"senderCity": "Riga",
"senderPostalCode": "LV-1010",
"senderPhone": "+37120000000",
"recipientName": "Jonas Petrauskas",
"recipientLine1": "Gedimino pr. 9",
"recipientCity": "Vilnius",
"recipientPostalCode": "01103",
"recipientPhone": "+37061234567",
"stationId": "LT-FIX-1"
}
}'Iegādājieties DRAFT etiķeti. Padodiet etiķetes id. Ja melnrakstam vēl nav sizeCode vai weightGrams, padodiet tos šeit — sizeCode jābūt šī kurjera catalog.sizeCodes vērtībai (piemēram, DPD nav XS). Melnrakstus, kuriem izmērs un svars jau ir saglabāti, joprojām var iegādāties tikai ar id. Atgriež PURCHASED ar izsekošanu. Live atslēgas rēķina pastu un platformas maksu.
Tipiskie kļūdu kodi: NOT_FOUND, VALIDATION, SIZE_NOT_OFFERED, PROVIDER_FAILURE, INSUFFICIENT_CREDIT, BILLING_REQUIRED, BILLING_PAST_DUE
GraphQL
mutation PurchaseLabel($id: String!, $sizeCode: SizeCode, $weightGrams: Int) {
purchaseLabel(id: $id, sizeCode: $sizeCode, weightGrams: $weightGrams) {
id
status
providerId
sizeCode
originCountry
destinationCountry
method
orderId
stationId
weightGrams
trackingCode
trackingUrl
parentLabelId
returnLabelId
}
}curl
curl -sS http://localhost:4000/graphql \
-H 'content-type: application/json' \
-H 'authorization: Bearer ps_test_YOUR_KEY' \
-d '{
"query": "mutation PurchaseLabel($id: String!, $sizeCode: SizeCode, $weightGrams: Int) {\n purchaseLabel(id: $id, sizeCode: $sizeCode, weightGrams: $weightGrams) {\n id\n status\n providerId\n sizeCode\n originCountry\n destinationCountry\n method\n orderId\n stationId\n weightGrams\n trackingCode\n trackingUrl\n parentLabelId\n returnLabelId\n }\n}",
"variables": {
"id": "label_01HZX",
"sizeCode": "M",
"weightGrams": 500
}
}'Iegādājieties Unisend, Pasts vai DPD etiķeti vienā pieprasījumā. Izcelsmei un galamērķim jābūt LV, EE vai LT. senderPhone un recipientPhone ir obligāti Baltijas E.164 numuri (+370, +371 vai +372). Piegādei uz automātu recipientPhone jābūt mobilajam. method un stationId izvēlas plānu: kurjers bez stationId ir mājas-uz-mājām; kurjers ar stationId ir mājas-uz-termināli; nodošana automātā bez stationId ir terminālis-uz-mājām; nodošana ar stationId ir terminālis-uz-termināli. stationId ir Station.id no searchStations, ne GraphQL enum. Padodiet sizeCode no shippingOptions vai izmērus, lai API ieteiktu izmēru. Neobligāts orderId saglabā jūsu veikala pasūtījuma id. Ja iepakosiet vēlāk, kasē labāk izmantojiet createDraftLabel.
Tipiskie kļūdu kodi: VALIDATION, SIZE_DOES_NOT_FIT, SIZE_NOT_OFFERED, COUNTRY_NOT_SUPPORTED, PROVIDER_FAILURE, INSUFFICIENT_CREDIT, BILLING_REQUIRED, BILLING_PAST_DUE
GraphQL
mutation CreateLabel(
$providerId: ProviderId!
$method: ShipmentMethod!
$originCountry: CountryCode!
$destinationCountry: CountryCode!
$weightGrams: Int!
$senderName: String!
$senderLine1: String!
$senderCity: String!
$senderPostalCode: String!
$senderPhone: String!
$recipientName: String!
$recipientLine1: String!
$recipientCity: String!
$recipientPostalCode: String!
$recipientPhone: String!
$sizeCode: SizeCode
$stationId: String
$orderId: String
$lengthMm: Int
$widthMm: Int
$heightMm: Int
) {
createLabel(
providerId: $providerId
method: $method
originCountry: $originCountry
destinationCountry: $destinationCountry
weightGrams: $weightGrams
senderName: $senderName
senderLine1: $senderLine1
senderCity: $senderCity
senderPostalCode: $senderPostalCode
senderPhone: $senderPhone
recipientName: $recipientName
recipientLine1: $recipientLine1
recipientCity: $recipientCity
recipientPostalCode: $recipientPostalCode
recipientPhone: $recipientPhone
sizeCode: $sizeCode
stationId: $stationId
orderId: $orderId
lengthMm: $lengthMm
widthMm: $widthMm
heightMm: $heightMm
) {
id
status
providerId
sizeCode
originCountry
destinationCountry
method
orderId
stationId
weightGrams
trackingCode
trackingUrl
parentLabelId
returnLabelId
}
}curl
curl -sS http://localhost:4000/graphql \
-H 'content-type: application/json' \
-H 'authorization: Bearer ps_test_YOUR_KEY' \
-d '{
"query": "mutation CreateLabel(\n $providerId: ProviderId!\n $method: ShipmentMethod!\n $originCountry: CountryCode!\n $destinationCountry: CountryCode!\n $weightGrams: Int!\n $senderName: String!\n $senderLine1: String!\n $senderCity: String!\n $senderPostalCode: String!\n $senderPhone: String!\n $recipientName: String!\n $recipientLine1: String!\n $recipientCity: String!\n $recipientPostalCode: String!\n $recipientPhone: String!\n $sizeCode: SizeCode\n $stationId: String\n $orderId: String\n $lengthMm: Int\n $widthMm: Int\n $heightMm: Int\n) {\n createLabel(\n providerId: $providerId\n method: $method\n originCountry: $originCountry\n destinationCountry: $destinationCountry\n weightGrams: $weightGrams\n senderName: $senderName\n senderLine1: $senderLine1\n senderCity: $senderCity\n senderPostalCode: $senderPostalCode\n senderPhone: $senderPhone\n recipientName: $recipientName\n recipientLine1: $recipientLine1\n recipientCity: $recipientCity\n recipientPostalCode: $recipientPostalCode\n recipientPhone: $recipientPhone\n sizeCode: $sizeCode\n stationId: $stationId\n orderId: $orderId\n lengthMm: $lengthMm\n widthMm: $widthMm\n heightMm: $heightMm\n ) {\n id\n status\n providerId\n sizeCode\n originCountry\n destinationCountry\n method\n orderId\n stationId\n weightGrams\n trackingCode\n trackingUrl\n parentLabelId\n returnLabelId\n }\n}",
"variables": {
"providerId": "UNISEND",
"method": "STATION_DROPOFF",
"originCountry": "LV",
"destinationCountry": "LT",
"weightGrams": 500,
"senderName": "Acme SIA",
"senderLine1": "Brivibas iela 1",
"senderCity": "Riga",
"senderPostalCode": "LV-1010",
"senderPhone": "+37120000000",
"recipientName": "Jonas Petrauskas",
"recipientLine1": "Gedimino pr. 9",
"recipientCity": "Vilnius",
"recipientPostalCode": "01103",
"recipientPhone": "+37061234567",
"sizeCode": "S",
"stationId": "LT-FIX-1",
"orderId": "ORD-1001"
}
}'Izdrukājiet atgriešanas uzlīmi iegādātai izejošajai etiķetei. Padodiet izejošo id. Jaunajai Label parentLabelId ir šis izejošais id; izejošajai tad ir returnLabelId. Izmantojiet downloadLabelPdf, trackLabel un cancelLabel ar jebkuru id. Katrai izejošajai etiķetei visvairāk viena atgriešana. Live DPD un Pasts atgriešanas vēl nepiedāvā. Unisend līgumam jābūt ieslēgtam atgriešanas servisam.
Tipiskie kļūdu kodi: NOT_FOUND, VALIDATION, PROVIDER_FAILURE, INSUFFICIENT_CREDIT, BILLING_REQUIRED, BILLING_PAST_DUE
GraphQL
mutation CreateReturnLabel($id: String!) {
createReturnLabel(id: $id) {
id
status
providerId
sizeCode
originCountry
destinationCountry
method
orderId
stationId
weightGrams
trackingCode
trackingUrl
parentLabelId
returnLabelId
}
}curl
curl -sS http://localhost:4000/graphql \
-H 'content-type: application/json' \
-H 'authorization: Bearer ps_test_YOUR_KEY' \
-d '{
"query": "mutation CreateReturnLabel($id: String!) {\n createReturnLabel(id: $id) {\n id\n status\n providerId\n sizeCode\n originCountry\n destinationCountry\n method\n orderId\n stationId\n weightGrams\n trackingCode\n trackingUrl\n parentLabelId\n returnLabelId\n }\n}",
"variables": {
"id": "label_01HZX"
}
}'Saraksts ar jūsu organizācijas etiķetēm, jaunākās vispirms. Padodiet orderId, lai atrastu etiķetes pēc veikala pasūtījuma, un status (piemēram, DRAFT vai READY_FOR_PICKUP), lai atlasītu. Statusi: DRAFT, PURCHASED, IN_TRANSIT, READY_FOR_PICKUP, DELIVERED, CANCELLED un FAILED. Atgriešanas etiķetēm ir parentLabelId; izejošajai ar atgriešanu ir returnLabelId.
GraphQL
query Labels($orderId: String, $status: LabelStatus) {
labels(orderId: $orderId, status: $status) {
id
status
providerId
sizeCode
originCountry
destinationCountry
method
orderId
stationId
weightGrams
trackingCode
trackingUrl
parentLabelId
returnLabelId
}
}curl
curl -sS http://localhost:4000/graphql \
-H 'content-type: application/json' \
-H 'authorization: Bearer ps_test_YOUR_KEY' \
-d '{
"query": "query Labels($orderId: String, $status: LabelStatus) {\n labels(orderId: $orderId, status: $status) {\n id\n status\n providerId\n sizeCode\n originCountry\n destinationCountry\n method\n orderId\n stationId\n weightGrams\n trackingCode\n trackingUrl\n parentLabelId\n returnLabelId\n }\n}",
"variables": {
"orderId": "ORD-1001",
"status": "DRAFT"
}
}'Iegūstiet vienu etiķeti pēc id, ieskaitot statusu, originCountry, destinationCountry, orderId, automāta stationId, neobligāto sizeCode un weightGrams, izsekošanu, parentLabelId (atgriešanai) un returnLabelId (izejošajai, kad atgriešana pastāv).
Tipiskie kļūdu kodi: NOT_FOUND
GraphQL
query Label($id: String!) {
label(id: $id) {
id
status
providerId
sizeCode
originCountry
destinationCountry
method
orderId
stationId
weightGrams
trackingCode
trackingUrl
parentLabelId
returnLabelId
}
}curl
curl -sS http://localhost:4000/graphql \
-H 'content-type: application/json' \
-H 'authorization: Bearer ps_test_YOUR_KEY' \
-d '{
"query": "query Label($id: String!) {\n label(id: $id) {\n id\n status\n providerId\n sizeCode\n originCountry\n destinationCountry\n method\n orderId\n stationId\n weightGrams\n trackingCode\n trackingUrl\n parentLabelId\n returnLabelId\n }\n}",
"variables": {
"id": "label_01HZX"
}
}'Vaicājiet kurjeram jaunāko skenējumu, saglabājiet to etiķetē un atgrieziet atjaunināto Label. Statuss var pāriet no PURCHASED uz IN_TRANSIT, READY_FOR_PICKUP (pakomāts), DELIVERED vai FAILED. Pixel-only CANCELLED joprojām var kļūt par IN_TRANSIT, ja piegādātāja sūtījums ir dzīvs. PROVIDER_FAILURE, ja kurjera izsaukums neizdodas.
Tipiskie kļūdu kodi: NOT_FOUND, PROVIDER_FAILURE
GraphQL
query TrackLabel($id: String!) {
trackLabel(id: $id) {
id
status
providerId
sizeCode
originCountry
destinationCountry
method
orderId
stationId
weightGrams
trackingCode
trackingUrl
parentLabelId
returnLabelId
}
}curl
curl -sS http://localhost:4000/graphql \
-H 'content-type: application/json' \
-H 'authorization: Bearer ps_test_YOUR_KEY' \
-d '{
"query": "query TrackLabel($id: String!) {\n trackLabel(id: $id) {\n id\n status\n providerId\n sizeCode\n originCountry\n destinationCountry\n method\n orderId\n stationId\n weightGrams\n trackingCode\n trackingUrl\n parentLabelId\n returnLabelId\n }\n}",
"variables": {
"id": "label_01HZX"
}
}'Atgriež etiķetes PDF kā data URL. Darbojas ar izejošo id vai atgriešanas id no createReturnLabel. Testa PDF ir ar ūdenszīmi. Atmiņā saglabātie PDF pazūd pēc API procesa restarta.
Tipiskie kļūdu kodi: NOT_FOUND
GraphQL
query DownloadLabelPdf($id: String!) {
downloadLabelPdf(id: $id)
}curl
curl -sS http://localhost:4000/graphql \
-H 'content-type: application/json' \
-H 'authorization: Bearer ps_test_YOUR_KEY' \
-d '{
"query": "query DownloadLabelPdf($id: String!) {\n downloadLabelPdf(id: $id)\n}",
"variables": {
"id": "label_01HZX"
}
}'Atceliet iegādātu etiķeti, kamēr kurjers to vēl atļauj. Venipak nav kurjera atcelšanas API: Pixel atzīmē etiķeti kā atceltu un atbrīvo rezervāciju; pats Venipak sūtījums netiek anulēts. Izejošās atcelšana atceļ arī saistīto atgriešanu, ja to vēl var atcelt. Atgriešanas id atceļ tikai atgriešanu. Atgriež true, ja atcelšana izdevās.
Tipiskie kļūdu kodi: NOT_FOUND, VALIDATION, PROVIDER_FAILURE
GraphQL
mutation CancelLabel($id: String!) {
cancelLabel(id: $id)
}curl
curl -sS http://localhost:4000/graphql \
-H 'content-type: application/json' \
-H 'authorization: Bearer ps_test_YOUR_KEY' \
-d '{
"query": "mutation CancelLabel($id: String!) {\n cancelLabel(id: $id)\n}",
"variables": {
"id": "label_01HZX"
}
}'Paku automāti un saņemšanas punkti Baltijas valstī (LV, EE vai LT). Pēc piegādātāja izvēles padodiet providerId. Ar latitude un longitude rezultāti ietver distanceMeters un ir kārtoti no tuvākā. Izmantojiet Station.id kā stationId createLabel vai createDraftLabel — automāti nav GraphQL enum.
Tipiskie kļūdu kodi: VALIDATION, COUNTRY_NOT_SUPPORTED
GraphQL
query SearchStations(
$countryCode: CountryCode!
$providerId: ProviderId
$latitude: Float
$longitude: Float
$limit: Int
) {
searchStations(
countryCode: $countryCode
providerId: $providerId
latitude: $latitude
longitude: $longitude
limit: $limit
) {
id
providerId
countryCode
name
line1
city
postalCode
latitude
longitude
distanceMeters
}
}curl
curl -sS http://localhost:4000/graphql \
-H 'content-type: application/json' \
-H 'authorization: Bearer ps_test_YOUR_KEY' \
-d '{
"query": "query SearchStations(\n $countryCode: CountryCode!\n $providerId: ProviderId\n $latitude: Float\n $longitude: Float\n $limit: Int\n) {\n searchStations(\n countryCode: $countryCode\n providerId: $providerId\n latitude: $latitude\n longitude: $longitude\n limit: $limit\n ) {\n id\n providerId\n countryCode\n name\n line1\n city\n postalCode\n latitude\n longitude\n distanceMeters\n }\n}",
"variables": {
"countryCode": "LV",
"providerId": "UNISEND",
"latitude": 56.9496,
"longitude": 24.1052,
"limit": 10
}
}'Reģistrējiet HTTPS URL, kas saņems etiķešu notikumus. Izejošā piegāde v1 ir daļēja.
Tipiskie kļūdu kodi: VALIDATION
GraphQL
mutation RegisterWebhookEndpoint($url: String!) {
registerWebhookEndpoint(url: $url) {
id
url
}
}curl
curl -sS http://localhost:4000/graphql \
-H 'content-type: application/json' \
-H 'authorization: Bearer ps_test_YOUR_KEY' \
-d '{
"query": "mutation RegisterWebhookEndpoint($url: String!) {\n registerWebhookEndpoint(url: $url) {\n id\n url\n }\n}",
"variables": {
"url": "https://merchant.example/webhooks/pixel-shipping"
}
}'Saraksts ar jau reģistrētajiem tīmekļa aizķeres URL jūsu organizācijai.
GraphQL
query WebhookEndpoints {
webhookEndpoints {
id
url
}
}curl
curl -sS http://localhost:4000/graphql \
-H 'content-type: application/json' \
-H 'authorization: Bearer ps_test_YOUR_KEY' \
-d '{
"query": "query WebhookEndpoints {\n webhookEndpoints {\n id\n url\n }\n}"
}'Pašreizējā platformas maksa, pasta izmaksas un kopsumma par live API atslēgu satiksmi. Testa atslēgu izsaukumi netiek rēķināti.
GraphQL
query OwnUsage {
ownUsage {
platformFee {
cents
currency
}
postage {
cents
currency
}
runningCost {
cents
currency
}
}
}curl
curl -sS http://localhost:4000/graphql \
-H 'content-type: application/json' \
-H 'authorization: Bearer ps_test_YOUR_KEY' \
-d '{
"query": "query OwnUsage {\n ownUsage {\n platformFee {\n cents\n currency\n }\n postage {\n cents\n currency\n }\n runningCost {\n cents\n currency\n }\n }\n}"
}'Domēna kļūdām GraphQL joprojām atgriež HTTP 200. Lasiet errors[].extensions.code. VALIDATION kļūdām extensions.field nosauc GraphQL argumentu (piemēram, senderPhone vai stationId).
| Kods | Nozīme |
|---|---|
VALIDATION | Trūkst obligāta argumenta vai tas nav derīgs. extensions.field nosauc argumentu. |
NOT_FOUND | Etiķete vai resurss jūsu organizācijā neeksistē. |
SIZE_DOES_NOT_FIT | Sūtījums neietilpst izvēlētajā izmērā. |
SIZE_NOT_OFFERED | Šis izmērs piegādātājam nav pieejams. |
COUNTRY_NOT_SUPPORTED | Izcelsme vai galamērķis ir ārpus LV, EE un LT. |
PROVIDER_FAILURE | Kurjera izsaukums neizdevās. Mēģiniet vēlreiz vai pārbaudiet ziņojumu. |
UNAUTHENTICATED | Nesēja atslēga trūkst vai ir noraidīta. |
FORBIDDEN | Atslēga ir derīga, bet šī operācija nav atļauta. |
INSUFFICIENT_CREDIT | Pieejamais priekšapmaksas kredīts nesedz šo live etiķeti. Iemaksājiet vai gaidiet papildināšanu. |
BILLING_REQUIRED | Live pirkumiem vajag pabeigtu iemaksu un noklusējuma maksāšanas līdzekli. |
BILLING_PAST_DUE | Stripe abonementam vai rēķinam vajadzīga uzmanība, pirms var izveidot jaunas live etiķetes. |
API atslēgas, dalībnieki un norēķini ir tirgotāja panelī (sesijas autentifikācija). Super-admin operācijas ir /admin/graphql un nav šajā lapā.