View orders¶
For all created requests webhooks will be sent, but you can query them through the endpoints:
Retrieve an order¶
To access a single specific order.
Required scope
Value | Description |
---|---|
open:order-order:read |
Allows access to an orders |
URL parameters
Field | Type | Description | Required |
---|---|---|---|
id |
uuid4 | Annotation identification | Yes |
Request:
curl -X 'GET' \
'https://api.magalu.com/v0/orders/{id}' \
-H 'accept: application/json' \
-H 'Authorization: Bearer <Access Token>' \
-H 'Content-Type: application/json' \
Response:
{
"id": "b1f95a16-443d-406e-956a-4335a700a76d",
"created_at": "2022-06-15T14:25:37Z",
"code": "TESTORDER0001",
"parent": "",
"purchased_at": "2022-03-15T18:21:50Z",
"currency": "BRL",
"normalizer": 100,
"links": {
"order": "https://id.magalu.com/accounts/dfb51775-56c5-43d5-b5fa-118529438ed3"
},
"channel": {
"id": "1aba5746-1d52-48a1-a7a7-c1307db5e262",
"extras": {}
},
"agreement": {
"buyer": {
"id": "712fe442-4185-4123-b3e6-fa57a5ea5d0e",
"extras": {}
},
"recipients": [
{
"id": "2aadcd24-b942-4267-b9e7-43057bb45eb2",
"address": {}
}
],
"sellers": [
{
"id": "f01a6e65-45c5-42c5-a135-f92422c32ecd",
"extras": {}
}
],
"id": "2dc0fa71-9cf2-45ad-aecb-590fee6dffa0",
"items": [
{
"id": "b5f76c0c-85db-4159-ae8c-0d8e943df98e",
"quantity": "1.5",
"offer": "https://api.magalu.com/distribution/v1/786972da-b648-4c48-afef-8c447b21c0d3/offers/bcdcb30a-aee6-430c-910b-90dbc7029aca",
"seller": "f01a6e65-45c5-42c5-a135-f92422c32ecd",
"sku": {
"code": "PROD01654-XYZ-MED",
"price": 1500
},
"total": 2250,
"extras": {}
}
],
"deliveries": [
{
"id": "b92d568f-7ec8-423c-aed8-75224fcaaf50",
"quantity": "1.5",
"item": "b5f76c0c-85db-4159-ae8c-0d8e943df98e",
"recipient": "2aadcd24-b942-4267-b9e7-43057bb45eb2",
"total": 3000,
"pickup_points": [],
"periods": [],
"extras": {}
}
],
"discounts": [
{
"id": "ff56b762-24b9-4ab9-bd04-754c47a24fe7",
"apply_to": "b5f76c0c-85db-4159-ae8c-0d8e943df98e",
"value": 100,
"extras": {}
}
],
"payments": [
{
"id": "a67244e4-95fd-41a0-a6f9-6e19538680b8",
"processor": {
"id": "a36f17ee-cd34-44e7-a41f-0aea8dce1b82",
"extras": {}
},
"method": "credit",
"installments": [
{
"date": "2022-03-15",
"value": 100
}
],
"value": 5150
}
],
"total": {
"items": 2250,
"deliveries": 3000,
"discounts": 100,
"total": 5150,
"payments": 5150
}
}
}
Note
For more information about status code, see Return code
Code | Description |
---|---|
200 | Ok |
401 | Unauthorized |
403 | Forbidden |
404 | Not Found |
422 | Unprocessable Entity |
500 | Internal Server Error |
502 | Bad Gateway |
503 | Service Unavailable |
504 | Gateway Timeout |
Retrieve orders¶
To retrieve a set of orders
Note
This endpoint implements pagination, sorting and filters. And sets the number of pages and records amount in each of them. To learn more, refer to Make paginated requests and query parameters.
Required scope
Value | Description |
---|---|
open:order-order:read |
Allows list to orders |
Query parameters
Field | Type | Description | Required |
---|---|---|---|
code |
uuid4 | Orders with code listed. | No |
code__in |
string | Order with specified code. | No |
parent |
string | Sub-orders of the specified order. | No |
Sort parameters
Field | Description | Required |
---|---|---|
created_at |
Sort Order by creation date. | No |
purchased_at |
Sort by date the order was placed. | No |
Request:
curl -X 'GET' \
'https://api.magalu.com/v0/orders' \
-H 'accept: application/json' \
-H 'Authorization: Bearer <Access Token>' \
-H 'Content-Type: application/json' \
Response:
{
"meta": {
...
},
"results": [
{
"id": "b1f95a16-443d-406e-956a-4335a700a76d",
"created_at": "2022-06-15T14:25:37Z",
"code": "TESTORDER0001",
"parent": "",
"purchased_at": "2022-03-15T18:21:50Z",
"currency": "BRL",
"normalizer": 100,
"links": {
"order": "https://id.magalu.com/accounts/dfb51775-56c5-43d5-b5fa-118529438ed3"
},
"channel": {
"id": "1aba5746-1d52-48a1-a7a7-c1307db5e262",
"extras": {}
},
"agreement": {
"buyer": {
"id": "712fe442-4185-4123-b3e6-fa57a5ea5d0e",
"extras": {}
},
"recipients": [
{
"id": "2aadcd24-b942-4267-b9e7-43057bb45eb2",
"address": {}
}
],
"sellers": [
{
"id": "f01a6e65-45c5-42c5-a135-f92422c32ecd",
"extras": {}
}
],
"id": "2dc0fa71-9cf2-45ad-aecb-590fee6dffa0",
"items": [
{
"id": "b5f76c0c-85db-4159-ae8c-0d8e943df98e",
"quantity": "1.5",
"offer": "https://api.magalu.com/distribution/v1/786972da-b648-4c48-afef-8c447b21c0d3/offers/bcdcb30a-aee6-430c-910b-90dbc7029aca",
"seller": "f01a6e65-45c5-42c5-a135-f92422c32ecd",
"sku": {
"code": "PROD01654-XYZ-MED",
"price": 1500
},
"total": 2250,
"extras": {}
}
],
"deliveries": [
{
"id": "b92d568f-7ec8-423c-aed8-75224fcaaf50",
"quantity": "1.5",
"item": "b5f76c0c-85db-4159-ae8c-0d8e943df98e",
"recipient": "2aadcd24-b942-4267-b9e7-43057bb45eb2",
"total": 3000,
"pickup_points": [],
"periods": [],
"extras": {}
}
],
"discounts": [
{
"id": "ff56b762-24b9-4ab9-bd04-754c47a24fe7",
"apply_to": "b5f76c0c-85db-4159-ae8c-0d8e943df98e",
"value": 100,
"extras": {}
}
],
"payments": [
{
"id": "a67244e4-95fd-41a0-a6f9-6e19538680b8",
"processor": {
"id": "a36f17ee-cd34-44e7-a41f-0aea8dce1b82",
"extras": {}
},
"method": "credit",
"installments": [
{
"date": "2022-03-15",
"value": 100
}
],
"value": 5150
}
],
"total": {
"items": 2250,
"deliveries": 3000,
"discounts": 100,
"total": 5150,
"payments": 5150
}
}
}
]
}
Return code
Note
For more information about status code, see Return code
Code | Description |
---|---|
200 | Ok |
400 | Bad Request |
401 | Unauthorized |
403 | Forbidden |
422 | Unprocessable Entity |
500 | Internal Server Error |
502 | Bad Gateway |
503 | Service Unavailable |
504 | Gateway Timeout |