Second-year internship, assignment for the company, delivered
Shipping slips created through an API, with no re-keying
The Lost Recordings restores rare recordings and sells them on vinyl and CD worldwide. For its warehouse, I developed a Node.js service that creates La Poste drop-off shipping slips through the API and automatically links them to the shipments tracked in Airtable.
Context and goal
The company was growing fast, with sales on every continent, and was preparing for Black Friday and the release of new records. Shipments were tracked in Airtable, and producing La Poste drop-off shipping slips took time, effort and money.
My assignment: code a stand-alone application that generates the shipping slip when an order is ready to go, and that fits in with the tools already in place. I was the company's first intern, and Node.js, which was required for the project, was new to me.
What I did
Understanding the API before writing code
I started by studying the Delivengo API: request types, error codes, response format. In parallel, I learnt Node.js and compared hosting and storage options. With the logistics manager, we then mapped out the exchanges between the application, Airtable, the host and the storage, and broke down the work: local code first, then retrieving the documents, sending them to Airtable, and finally hosting.
The journey of a request
Send one request, or three at once: the queue processes them one after another, and the diagram lights up at each step. Fictitious numbers; the code and credentials are not published.
- $ npm start
- Server listening on port 3000
The service
- A route receives from Airtable the list of parcels to drop off and rejects malformed requests.
- A queue processes the requests one at a time, and each one gets its own response once its drop-off is complete.
- For each parcel, the service looks up its identifier through the API, then creates the drop-off and retrieves the shipping slip as a PDF.
- The PDF is stored in Google Cloud Storage, and the matching shipment is updated in Airtable: shipping slip attached and drop-off number.
- Each step writes an explicit error message to the logs, so you know straight away where a request failed.
I then adapted the same design for the Colissimo API, on the second assignment of the same kind.
The difficulties
- Imprecise API documentation, particularly for retrieving the PDFs and building the requests: I made progress using the error codes returned, the documentation and developer forums.
- An incompatible format. The API returns the shipping slip in a form that Airtable cannot attach directly. Hence the intermediate storage step in Google Cloud Storage.
- A scope to clarify. At first I thought I had to build a graphical interface; that was not expected. Regular discussions helped refocus the goal.
- Testing covered the reliability of the API calls, the interaction with Airtable and the generation of the shipping slips, checking that no sensitive information ended up in the Airtable data.
Verifiable results
- RecordedService delivered and hosted on Heroku, with documentation and a Git repository handed over to the company for maintenance.
- EstimatedHosting and storage cost of about two euro cents a month, according to my internship report.
- RecordedThe time saved on preparing shipments was not measured, so I do not put forward a figure.
What this internship taught me
Reading API documentation and working out the right requests from it, learning a language on the job in a month, and designing a service meant to be maintained by others: it was the first time I had written professional documentation. Working fully remotely, with a single, often busy, point of contact, also made me look for answers on my own before asking.