Find here some tips and use cases to help you set your requests and actions with our API.

In order to illustrate these use cases, we have chosen to use a test merchant.

  • Let's call our test merchant "Julia" and say that her account number is "1". 
  • Please note that she is using Postman to make all her API calls.
  • Results will be in JSON format
  • These use cases are pure examples

More info about Postman and how to create a collection (group of saved request) here.  

Connect to our API: Get access token

  • First step before making a request call or any action within the Lengow API is to enter the API
To do so, Julia needs to collect her credentials from her Lengow account that are: 
Lengow account ID
- secret token
- token 
 and open Postman. 
Then, once she has set a new environment into Postman with her credentials she can proceed and POST the first call which is:
 
POST /access/get_token

  • The API sends back an access token such as this one: 
{
    "token": "69946b78-edae-49b8-8874-6fb025e09a58",
   "account_id": 1
}
She ads this token to her Postan environment under the variable LENGOW_AUTH (see image).
The "token" sent out by the Lengow API lasts 3600 seconds and can now be used as Lengow_AUTH in Postman.
Tip: With the help of your developers you can set up a script that makes this call automatically every hour.    

Check actions on orders

Julia has corrected one of her ship action on an orders. She wants to check that her last action is correct and that the action she sent has been correctly processed by the Lengow API towards the channel's API.


  • GET /orders/actions/  
From the Lengow API, she queries this specific order using the "&marketplace_order_id" parameter and use the ID of her order. (see image)
  • API response
The Lengow API response indicates that 2 actions were made on this order:
{
   "count": 2,
   "next": null,
   "previous": null,
   "results": [
        {
In the results, you can see that the order id appears twice. It means that the server shows the same order twice because two actions were made. The last action is shown at the top of the response.

At the very bottom of the response look at the following parameters: 
  • "action_type"
  • "processed"
  • "queued"
  • "error"

1/ The first “ship” action, Julia sent earlier, is not valid because we see in the API response:

"processed": false
"error": "Tracking needs number AND carrier for ship order action" 

Here, eBay API is teling Lengow's API, that Julia's "ship" action is incomplete because one or more parameters were missing.

  • You can see that parameter "tracking_number" is null in the first "ship" action.
2/ The second "ship" action is valid because: 
  • "processed": true
  • "queued": false
  • "error": null

More info on "queued" and "processed" object here.

Get Shipment information on orders

Julia, our test merchant, received a new order from La Redoute marketplace. She wants to find the requested shipping information to help her ship the order. 

It means, that she wants to know what information she must complete to correctly send her order.
STEP 1
Once connected to the Lengow API, she queries her order (see image) using the /orders endpoint like this:

GET /orders/?account_id=1&marketplace_order_id=2020.111.123456789
  • The order is in the "waiting_shipment" status. 

From the "delivery" > "trackings" parameter of the API response, Julia can check the delivery method chosen by the customer:
  • "method": "Home / Regular"
From this "tracking" parameter, other information can be found and could be completed depending on the delivery method chosen by the customer:
"is_delivered_by_marketplace": null,
"pickup_store": { "id": null },
"relay": { "id": null, "name": null

Note: If the "Relais / Regular" method had been chosen, the "relay" parameter of the order would have been completed with an Identifier and a name of the relay point.

STEP 2
Julia then queries the overall marketplace information in order to know what are the mandatory elements to fill in to correctly ship her order. 
From the API, this time she uses the endpoint /marketplace:

GET /marketplaces/?marketplace=laredoute  

In the response that the Lengow API returns, she could find 
  • list of order status 
  • Authorized actions on orders and mandatory parameters to complete per action
  • Authorized carriers by the marketplace in the "carriers" tag
For La Redoute, she finds: 
 
 "actions": {
               "ship": {
                   "args": [
                        "carrier",
                        "tracking_number"
                    ],
Then she consults the "carrier" tag to know if valid values are mandatory or not:
"carrier": {
                           "type": "string",
                           "valid_values": {},
                           "default_value": "",
                            "accept_free_values": true 
This means that to validate the shipment of her La Redoute order (home delivery), Julia must provide
  • the "carrier" information
  • a "tracking_number"
As there is no list of mandatory carriers, she can use the carrier of her choice.

API / Use cases

Find here some tips and use cases to help you set your requests and actions with our API.

In order to illustrate these use cases, we have chosen to use a test merchant.

  • Let's call our test merchant "Julia" and say that her account number is "1". 
  • Please note that she is using Postman to make all her API calls.
  • Results will be in JSON format
  • These use cases are pure examples

More info about Postman and how to create a collection (group of saved request) here.  

Connect to our API: Get access token

  • First step before making a request call or any action within the Lengow API is to enter the API
To do so, Julia needs to collect her credentials from her Lengow account that are: 
Lengow account ID
- secret token
- token 
 and open Postman. 
Then, once she has set a new environment into Postman with her credentials she can proceed and POST the first call which is:
 
POST /access/get_token

  • The API sends back an access token such as this one: 
{
    "token": "69946b78-edae-49b8-8874-6fb025e09a58",
   "account_id": 1
}
She ads this token to her Postan environment under the variable LENGOW_AUTH (see image).
The "token" sent out by the Lengow API lasts 3600 seconds and can now be used as Lengow_AUTH in Postman.
Tip: With the help of your developers you can set up a script that makes this call automatically every hour.    

Check actions on orders

Julia has corrected one of her ship action on an orders. She wants to check that her last action is correct and that the action she sent has been correctly processed by the Lengow API towards the channel's API.


  • GET /orders/actions/  
From the Lengow API, she queries this specific order using the "&marketplace_order_id" parameter and use the ID of her order. (see image)
  • API response
The Lengow API response indicates that 2 actions were made on this order:
{
   "count": 2,
   "next": null,
   "previous": null,
   "results": [
        {
In the results, you can see that the order id appears twice. It means that the server shows the same order twice because two actions were made. The last action is shown at the top of the response.

At the very bottom of the response look at the following parameters: 
  • "action_type"
  • "processed"
  • "queued"
  • "error"

1/ The first “ship” action, Julia sent earlier, is not valid because we see in the API response:

"processed": false
"error": "Tracking needs number AND carrier for ship order action" 

Here, eBay API is teling Lengow's API, that Julia's "ship" action is incomplete because one or more parameters were missing.

  • You can see that parameter "tracking_number" is null in the first "ship" action.
2/ The second "ship" action is valid because: 
  • "processed": true
  • "queued": false
  • "error": null

More info on "queued" and "processed" object here.

Get Shipment information on orders

Julia, our test merchant, received a new order from La Redoute marketplace. She wants to find the requested shipping information to help her ship the order. 

It means, that she wants to know what information she must complete to correctly send her order.
STEP 1
Once connected to the Lengow API, she queries her order (see image) using the /orders endpoint like this:

GET /orders/?account_id=1&marketplace_order_id=2020.111.123456789
  • The order is in the "waiting_shipment" status. 

From the "delivery" > "trackings" parameter of the API response, Julia can check the delivery method chosen by the customer:
  • "method": "Home / Regular"
From this "tracking" parameter, other information can be found and could be completed depending on the delivery method chosen by the customer:
"is_delivered_by_marketplace": null,
"pickup_store": { "id": null },
"relay": { "id": null, "name": null

Note: If the "Relais / Regular" method had been chosen, the "relay" parameter of the order would have been completed with an Identifier and a name of the relay point.

STEP 2
Julia then queries the overall marketplace information in order to know what are the mandatory elements to fill in to correctly ship her order. 
From the API, this time she uses the endpoint /marketplace:

GET /marketplaces/?marketplace=laredoute  

In the response that the Lengow API returns, she could find 
  • list of order status 
  • Authorized actions on orders and mandatory parameters to complete per action
  • Authorized carriers by the marketplace in the "carriers" tag
For La Redoute, she finds: 
 
 "actions": {
               "ship": {
                   "args": [
                        "carrier",
                        "tracking_number"
                    ],
Then she consults the "carrier" tag to know if valid values are mandatory or not:
"carrier": {
                           "type": "string",
                           "valid_values": {},
                           "default_value": "",
                            "accept_free_values": true 
This means that to validate the shipment of her La Redoute order (home delivery), Julia must provide
  • the "carrier" information
  • a "tracking_number"
As there is no list of mandatory carriers, she can use the carrier of her choice.
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request