Small Label
Generates 10x10cm labels to stick on packages. If the guide has multiple packages, it generates one page per package.
GET /api/guias/etiqueta-pequena/{guia}
Required permission: guias.read
Parameters
| Parameter | Type | Description |
|---|---|---|
guia | string | Guide number (e.g.: URU030856) |
Label Contents
- Logo
- Route code:
MX-{ORIGIN}-{DESTINATION} - Unique package code
- From: sender, delivery type, phone
- To: recipient, address, phone
- Service, quantity (X of Y), date
- Barcode + guide number
Example
curl -X GET "https://ws-api.masaprisaoperativo.com/api/guias/etiqueta-pequena/URU030856" \
-H "Authorization: Bearer {token}"
Response
{
"response": "OK",
"message": "Etiqueta pequena generada exitosamente",
"data": {
"guia": "URU030856",
"pdf_base64": "JVBERi0xLjQK...",
"filename": "URU030856_small.pdf"
}
}
Multiple Packages
If the guide has multiple packages, the PDF will contain multiple pages:
- Page 1: Package 1 of 3
- Page 2: Package 2 of 3
- Page 3: Package 3 of 3
Each label shows its sequence number.
Decoding the PDF
JavaScript
const response = await fetch('/api/guias/etiqueta-pequena/URU030856', {
headers: { 'Authorization': 'Bearer ' + token }
});
const json = await response.json();
const pdfData = atob(json.data.pdf_base64);
const bytes = new Uint8Array(pdfData.length);
for (let i = 0; i < pdfData.length; i++) {
bytes[i] = pdfData.charCodeAt(i);
}
const blob = new Blob([bytes], { type: 'application/pdf' });
window.open(URL.createObjectURL(blob));
C#
byte[] pdfBytes = Convert.FromBase64String(response.Data.PdfBase64);
File.WriteAllBytes(response.Data.Filename, pdfBytes);
PHP
$pdfContent = base64_decode($response['data']['pdf_base64']);
file_put_contents($response['data']['filename'], $pdfContent);
:::tip Print Recommendation Print on adhesive paper for easy attachment to packages. The 10x10cm size is optimized for standard labels. :::