Integrating the Livrăria API into your application
A step-by-step guide to implementing our API and fully automating the delivery process.
By following this guide, you will be able to integrate the Livrăria API and fully automate the delivery process.
Getting ready for the integration
Before you start the integration, make sure you have the following:
- An active Livrăria account
- An API key (the recommended option for company accounts) or the account email address and password, for authentication
- Your development environment set up
The first API call
Let us start with a simple authentication example. The response contains data.accessToken, which you send in the Authorization: Bearer header on the following requests:
curl -X POST https://www.api.livraria.ro/auth/login \
-H "Content-Type: application/json" \
-d '{"email": "your-email@example.com", "password": "your-password"}'Creating a delivery
A shipment is created in four calls: the quotes (POST /public/awb/quotes), choosing the courier (PUT /quote-request/{id}/selected-courier-quote), the billing details (POST /quote-request/{id}/billing-info) and, finally, POST /expedition with the identifier of the quote request:
{
"quoteRequestId": "3f9c1a34-7b2e-4d81-9f05-6c1e8a4b2d70"
}Handling responses
The response of POST /expedition contains awbNumber, trackingNumber, price and status.