Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

B2B API Overview: User Authorization

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

B2B API Overview

Following document describes doboxa B2B Api for placing orders and order status checks.
Api uses rest endpoints in json format. In order to place an order or check order status you
need to first authenticate your user via authorization endpoint. Received token is valid for 1h
only and needs to be attached to requests via http header in order to successfully place
order or check status.

API Endpoints
Our API has 3 different endpoints, based on the language. Please contact your customer
representative in order to establish which endpoint is correct for your account.

● https://b2b-pl.doboxa.biz/rest/b2bpl/V1/
● https://b2b-en.doboxa.biz/rest/b2ben/V1/
● https://b2b-de.doboxa.biz/rest/b2bde/V1/

API Methods Reference

USER AUTHORIZATION

METHOD URL:
ENDPOINT + integration/customer/token

HTTP METHOD:
POST

HTTP HEADERS:
Content-Type: application/json

REQUEST BODY:
{
"username": "string",
"password": "string"
}

EXAMPLE REQUEST:

{
"username": "pawel@doboxa.biz",
"password" => "SecretP@ssword1"
}

RESULT - SUCCESS:

"TOKEN"

EXAMPLE RESPONSE:

"2eivjdncgbj21n6os2rzofqktqv8rqjz"

RESULT - ERROR:

{
"message": "string",
"errors": [
{
"message": "string",
"parameters": [
{
"resources": "string",
"fieldName": "string",
"fieldValue": "string"
}
]
}
],
"code": 0,
"parameters": [
{
"resources": "string",
"fieldName": "string",
"fieldValue": "string"
}
],
"trace": "string"
}

PLACE ORDER

METHOD URL:
ENDPOINT + b2b/order/place

METHOD:
POST

HEADERS:
Content-Type: application/json
Authorization: Bearer TOKEN

REQUEST BODY:

{
"order": {
"externalId": "string",
"customer": {
"firstName": "string",
"lastName": "string",
"companyName": "string",
"phoneNumber": "string",
"email": "string",
"address1": "string",
"address2": "string",
"city": "string",
"region": "string",
"postCode": "string",
"countryIso": "string"
},
"articles": [
{
"id": "string",
"name": "string",
"qty": 0,
"price": "string",
"widthInCm": 0,
"heightInCm": 0,
"customFile": "string",
"foreignId": "string"
}
],
"date": "string",
"source": "string",
"info": "string",
"companyName": "string",
"cashOnDeliveryAmount": "string",
"cashOnDeliveryCurrency": "string",
"currency": "string",
}
}

Example request:

{
"order": {
"externalId": "456756",
"customer": {
"firstName": "Marcin",
"lastName": "Bojanowski",
"companyName": "Consulting",
"phoneNumber": "914345676",
"email": "marcin@bojanowski.com",
"address1": "Teczowa 21",
"address2": "",
"city": "Szczecin",
"region": "Zachodniopomorskie",
"postCode": "72006",
"countryIso": "PL"
},
"articles": [
{
"id": "LB-1141-C70-50",
"name": "Produkt testowy",
"qty": "3",
"price": "222",
"widthInCm": "50",
"heightInCm": "50",
"customFile": "https://doboxa.biz/assets/img/header__img.png",
"foreignId": "555test1"
}
],
"date": "2021-08-23",
"source": "Smart",
"info": "Insert any comments here",
"currency": "PLN",
"companyName": "Smart",
"cashOnDeliveryAmount": "",
"cashOnDeliveryCurrency": ""
}
}

RESULT (SUCCESS OR ERROR):

{
"result_code": 0,
"order_id": "string",
"errors": [
"string"
]
}

Example success:

RESULT (INTERNAL ERROR):

{
"message": "string",
"errors": [
{
"message": "string",
"parameters": [
{
"resources": "string",
"fieldName": "string",
"fieldValue": "string"
}
]
}
],
"code": 0,
"parameters": [
{
"resources": "string",
"fieldName": "string",
"fieldValue": "string"
}
],
"trace": "string"
}

Order status

URL:
ENDPOINT + b2b/order/status

METHOD:
POST

HEADERS:
Content-Type: application/json
Authorization: Bearer TOKEN

REQUEST BODY:

{
"orderId": int
}

Example request:

{
"orderId": 1611454
}

Example success response:

{
"order_status": "complete",
"order_tracking": [
{
"carrier_name": "fedex",
"tracking_number": "282384621387"
}
],
"errors": []
}
Example error response:

{
"order_status": null,
"order_tracking": [],
"errors": [
"No such entity with orderId = 2147532525"
]
}

Possible statuses:
1. pending
2. processing
3. complete
4. canceled

You might also like