curl --request POST \
--url https://api.getjusto.com/api/v2/deliveries \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"storeId": "<string>",
"placeId": "<string>",
"placeName": "<string>",
"placePhone": "<string>",
"expectedDate": "2023-11-07T05:31:56Z",
"contents": {
"name": "<string>",
"quantity": 123,
"description": "<string>",
"unitPrice": 123
},
"instructions": "<string>",
"externalId": "<string>",
"tipAmount": 123,
"latitude": -33.4489,
"longitude": -70.6693,
"preferCoordinates": false,
"maxDistance": 123,
"addressLine1": "<string>",
"addressLine2": "<string>",
"isToStore": false,
"isRoundTrip": false,
"avoidDuplication": false
}
'import requests
url = "https://api.getjusto.com/api/v2/deliveries"
payload = {
"storeId": "<string>",
"placeId": "<string>",
"placeName": "<string>",
"placePhone": "<string>",
"expectedDate": "2023-11-07T05:31:56Z",
"contents": {
"name": "<string>",
"quantity": 123,
"description": "<string>",
"unitPrice": 123
},
"instructions": "<string>",
"externalId": "<string>",
"tipAmount": 123,
"latitude": -33.4489,
"longitude": -70.6693,
"preferCoordinates": False,
"maxDistance": 123,
"addressLine1": "<string>",
"addressLine2": "<string>",
"isToStore": False,
"isRoundTrip": False,
"avoidDuplication": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
storeId: '<string>',
placeId: '<string>',
placeName: '<string>',
placePhone: '<string>',
expectedDate: '2023-11-07T05:31:56Z',
contents: {name: '<string>', quantity: 123, description: '<string>', unitPrice: 123},
instructions: '<string>',
externalId: '<string>',
tipAmount: 123,
latitude: -33.4489,
longitude: -70.6693,
preferCoordinates: false,
maxDistance: 123,
addressLine1: '<string>',
addressLine2: '<string>',
isToStore: false,
isRoundTrip: false,
avoidDuplication: false
})
};
fetch('https://api.getjusto.com/api/v2/deliveries', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.getjusto.com/api/v2/deliveries",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'storeId' => '<string>',
'placeId' => '<string>',
'placeName' => '<string>',
'placePhone' => '<string>',
'expectedDate' => '2023-11-07T05:31:56Z',
'contents' => [
'name' => '<string>',
'quantity' => 123,
'description' => '<string>',
'unitPrice' => 123
],
'instructions' => '<string>',
'externalId' => '<string>',
'tipAmount' => 123,
'latitude' => -33.4489,
'longitude' => -70.6693,
'preferCoordinates' => false,
'maxDistance' => 123,
'addressLine1' => '<string>',
'addressLine2' => '<string>',
'isToStore' => false,
'isRoundTrip' => false,
'avoidDuplication' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.getjusto.com/api/v2/deliveries"
payload := strings.NewReader("{\n \"storeId\": \"<string>\",\n \"placeId\": \"<string>\",\n \"placeName\": \"<string>\",\n \"placePhone\": \"<string>\",\n \"expectedDate\": \"2023-11-07T05:31:56Z\",\n \"contents\": {\n \"name\": \"<string>\",\n \"quantity\": 123,\n \"description\": \"<string>\",\n \"unitPrice\": 123\n },\n \"instructions\": \"<string>\",\n \"externalId\": \"<string>\",\n \"tipAmount\": 123,\n \"latitude\": -33.4489,\n \"longitude\": -70.6693,\n \"preferCoordinates\": false,\n \"maxDistance\": 123,\n \"addressLine1\": \"<string>\",\n \"addressLine2\": \"<string>\",\n \"isToStore\": false,\n \"isRoundTrip\": false,\n \"avoidDuplication\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.getjusto.com/api/v2/deliveries")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"storeId\": \"<string>\",\n \"placeId\": \"<string>\",\n \"placeName\": \"<string>\",\n \"placePhone\": \"<string>\",\n \"expectedDate\": \"2023-11-07T05:31:56Z\",\n \"contents\": {\n \"name\": \"<string>\",\n \"quantity\": 123,\n \"description\": \"<string>\",\n \"unitPrice\": 123\n },\n \"instructions\": \"<string>\",\n \"externalId\": \"<string>\",\n \"tipAmount\": 123,\n \"latitude\": -33.4489,\n \"longitude\": -70.6693,\n \"preferCoordinates\": false,\n \"maxDistance\": 123,\n \"addressLine1\": \"<string>\",\n \"addressLine2\": \"<string>\",\n \"isToStore\": false,\n \"isRoundTrip\": false,\n \"avoidDuplication\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getjusto.com/api/v2/deliveries")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"storeId\": \"<string>\",\n \"placeId\": \"<string>\",\n \"placeName\": \"<string>\",\n \"placePhone\": \"<string>\",\n \"expectedDate\": \"2023-11-07T05:31:56Z\",\n \"contents\": {\n \"name\": \"<string>\",\n \"quantity\": 123,\n \"description\": \"<string>\",\n \"unitPrice\": 123\n },\n \"instructions\": \"<string>\",\n \"externalId\": \"<string>\",\n \"tipAmount\": 123,\n \"latitude\": -33.4489,\n \"longitude\": -70.6693,\n \"preferCoordinates\": false,\n \"maxDistance\": 123,\n \"addressLine1\": \"<string>\",\n \"addressLine2\": \"<string>\",\n \"isToStore\": false,\n \"isRoundTrip\": false,\n \"avoidDuplication\": false\n}"
response = http.request(request)
puts response.read_body{
"_id": "<string>",
"price": 123,
"status": "canceled",
"placeName": "<string>",
"isCash": "<string>",
"fromLocation": {
"address": "<string>",
"addressSecondary": "<string>",
"storeName": "<string>",
"lat": -33.4489,
"lng": -70.6693
},
"toLocation": {
"address": "<string>",
"addressSecondary": "<string>",
"storeName": "<string>",
"lat": -33.4489,
"lng": -70.6693
},
"receiveProofImage": "<string>",
"deliverProofImage": "<string>",
"driverPassword": "<string>",
"activatesAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"forDate": "2023-11-07T05:31:56Z",
"completedAt": "2023-11-07T05:31:56Z",
"canceledAt": "2023-11-07T05:31:56Z",
"nearStoreAt": "2023-11-07T05:31:56Z",
"nearClientAt": "2023-11-07T05:31:56Z",
"deliveryExpectedAt": "2023-11-07T05:31:56Z",
"driverReceivedAt": "2023-11-07T05:31:56Z",
"trackingURL": "<string>",
"deliveryInformation": "<string>",
"driverInformation": {
"code": "<string>",
"type": "<string>",
"phone": "<string>",
"name": "<string>",
"categoryId": "<string>",
"image": "<string>"
},
"instructions": "<string>",
"specialCode": "<string>",
"externalId": "<string>",
"orderId": "<string>",
"uncompletedReason": "<string>"
}{
"status": "error",
"error": "Error en la petición"
}{
"status": "error",
"error": "Unauthorized"
}Crear solicitud de despacho
Usa este metodo para crear una solicitud de despacho
curl --request POST \
--url https://api.getjusto.com/api/v2/deliveries \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"storeId": "<string>",
"placeId": "<string>",
"placeName": "<string>",
"placePhone": "<string>",
"expectedDate": "2023-11-07T05:31:56Z",
"contents": {
"name": "<string>",
"quantity": 123,
"description": "<string>",
"unitPrice": 123
},
"instructions": "<string>",
"externalId": "<string>",
"tipAmount": 123,
"latitude": -33.4489,
"longitude": -70.6693,
"preferCoordinates": false,
"maxDistance": 123,
"addressLine1": "<string>",
"addressLine2": "<string>",
"isToStore": false,
"isRoundTrip": false,
"avoidDuplication": false
}
'import requests
url = "https://api.getjusto.com/api/v2/deliveries"
payload = {
"storeId": "<string>",
"placeId": "<string>",
"placeName": "<string>",
"placePhone": "<string>",
"expectedDate": "2023-11-07T05:31:56Z",
"contents": {
"name": "<string>",
"quantity": 123,
"description": "<string>",
"unitPrice": 123
},
"instructions": "<string>",
"externalId": "<string>",
"tipAmount": 123,
"latitude": -33.4489,
"longitude": -70.6693,
"preferCoordinates": False,
"maxDistance": 123,
"addressLine1": "<string>",
"addressLine2": "<string>",
"isToStore": False,
"isRoundTrip": False,
"avoidDuplication": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
storeId: '<string>',
placeId: '<string>',
placeName: '<string>',
placePhone: '<string>',
expectedDate: '2023-11-07T05:31:56Z',
contents: {name: '<string>', quantity: 123, description: '<string>', unitPrice: 123},
instructions: '<string>',
externalId: '<string>',
tipAmount: 123,
latitude: -33.4489,
longitude: -70.6693,
preferCoordinates: false,
maxDistance: 123,
addressLine1: '<string>',
addressLine2: '<string>',
isToStore: false,
isRoundTrip: false,
avoidDuplication: false
})
};
fetch('https://api.getjusto.com/api/v2/deliveries', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.getjusto.com/api/v2/deliveries",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'storeId' => '<string>',
'placeId' => '<string>',
'placeName' => '<string>',
'placePhone' => '<string>',
'expectedDate' => '2023-11-07T05:31:56Z',
'contents' => [
'name' => '<string>',
'quantity' => 123,
'description' => '<string>',
'unitPrice' => 123
],
'instructions' => '<string>',
'externalId' => '<string>',
'tipAmount' => 123,
'latitude' => -33.4489,
'longitude' => -70.6693,
'preferCoordinates' => false,
'maxDistance' => 123,
'addressLine1' => '<string>',
'addressLine2' => '<string>',
'isToStore' => false,
'isRoundTrip' => false,
'avoidDuplication' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.getjusto.com/api/v2/deliveries"
payload := strings.NewReader("{\n \"storeId\": \"<string>\",\n \"placeId\": \"<string>\",\n \"placeName\": \"<string>\",\n \"placePhone\": \"<string>\",\n \"expectedDate\": \"2023-11-07T05:31:56Z\",\n \"contents\": {\n \"name\": \"<string>\",\n \"quantity\": 123,\n \"description\": \"<string>\",\n \"unitPrice\": 123\n },\n \"instructions\": \"<string>\",\n \"externalId\": \"<string>\",\n \"tipAmount\": 123,\n \"latitude\": -33.4489,\n \"longitude\": -70.6693,\n \"preferCoordinates\": false,\n \"maxDistance\": 123,\n \"addressLine1\": \"<string>\",\n \"addressLine2\": \"<string>\",\n \"isToStore\": false,\n \"isRoundTrip\": false,\n \"avoidDuplication\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.getjusto.com/api/v2/deliveries")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"storeId\": \"<string>\",\n \"placeId\": \"<string>\",\n \"placeName\": \"<string>\",\n \"placePhone\": \"<string>\",\n \"expectedDate\": \"2023-11-07T05:31:56Z\",\n \"contents\": {\n \"name\": \"<string>\",\n \"quantity\": 123,\n \"description\": \"<string>\",\n \"unitPrice\": 123\n },\n \"instructions\": \"<string>\",\n \"externalId\": \"<string>\",\n \"tipAmount\": 123,\n \"latitude\": -33.4489,\n \"longitude\": -70.6693,\n \"preferCoordinates\": false,\n \"maxDistance\": 123,\n \"addressLine1\": \"<string>\",\n \"addressLine2\": \"<string>\",\n \"isToStore\": false,\n \"isRoundTrip\": false,\n \"avoidDuplication\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getjusto.com/api/v2/deliveries")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"storeId\": \"<string>\",\n \"placeId\": \"<string>\",\n \"placeName\": \"<string>\",\n \"placePhone\": \"<string>\",\n \"expectedDate\": \"2023-11-07T05:31:56Z\",\n \"contents\": {\n \"name\": \"<string>\",\n \"quantity\": 123,\n \"description\": \"<string>\",\n \"unitPrice\": 123\n },\n \"instructions\": \"<string>\",\n \"externalId\": \"<string>\",\n \"tipAmount\": 123,\n \"latitude\": -33.4489,\n \"longitude\": -70.6693,\n \"preferCoordinates\": false,\n \"maxDistance\": 123,\n \"addressLine1\": \"<string>\",\n \"addressLine2\": \"<string>\",\n \"isToStore\": false,\n \"isRoundTrip\": false,\n \"avoidDuplication\": false\n}"
response = http.request(request)
puts response.read_body{
"_id": "<string>",
"price": 123,
"status": "canceled",
"placeName": "<string>",
"isCash": "<string>",
"fromLocation": {
"address": "<string>",
"addressSecondary": "<string>",
"storeName": "<string>",
"lat": -33.4489,
"lng": -70.6693
},
"toLocation": {
"address": "<string>",
"addressSecondary": "<string>",
"storeName": "<string>",
"lat": -33.4489,
"lng": -70.6693
},
"receiveProofImage": "<string>",
"deliverProofImage": "<string>",
"driverPassword": "<string>",
"activatesAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"forDate": "2023-11-07T05:31:56Z",
"completedAt": "2023-11-07T05:31:56Z",
"canceledAt": "2023-11-07T05:31:56Z",
"nearStoreAt": "2023-11-07T05:31:56Z",
"nearClientAt": "2023-11-07T05:31:56Z",
"deliveryExpectedAt": "2023-11-07T05:31:56Z",
"driverReceivedAt": "2023-11-07T05:31:56Z",
"trackingURL": "<string>",
"deliveryInformation": "<string>",
"driverInformation": {
"code": "<string>",
"type": "<string>",
"phone": "<string>",
"name": "<string>",
"categoryId": "<string>",
"image": "<string>"
},
"instructions": "<string>",
"specialCode": "<string>",
"externalId": "<string>",
"orderId": "<string>",
"uncompletedReason": "<string>"
}{
"status": "error",
"error": "Error en la petición"
}{
"status": "error",
"error": "Unauthorized"
}Descripción
Este método posibilita la creación de una solicitud de reparto especial, generando un envío de forma inmediata o programada. Adicionalmente, incorpora un mecanismo de indempotencia y personalización de la entrega.Nota al margen
Los pedidos especiales no están limitados en los horarios de venta que establezca la marca, siendo de exclusiva responsabilidad del solicitante el verificar si pueden despachar el producto en cuestión.Ejemplo con placeId
Descripción
Este endpoint muestra un ejemplo de crear un delivery con placeIdRespuesta
{
"placeId": "Ch43134gggXP5g5g5RPWmn-5gg35",
"addressLine2": "Dpto 144",
"storeId": "Li4eEa3W2hiuGGCFa",
"isToStore": false,
"isRoundTrip": false,
"externalId": "P13G3",
"tipAmount": 1000,
"placeName": "Javier Perez",
"placePhone": "+56956385416",
"expectedDate": "2020-04-17T22:15:26Z",
"contents": [
{
"quantity": 1,
"name": "Pizza",
"description": "Extras: Bebida 1.5lt",
"unitPrice": 1000
}
]
}
Respuesta
{
"status": "ok",
"data": {
<Delivery>
}
}
Ejemplo sin placeId
Descripción
Este endpoint muestra un ejemplo de crear un delivery con placeIdRespuesta
{
"latitude": "-33.4421928",
"longitude": "-70.665261",
"addressLine1": "Concha y Toro 33",
"addressLine2": "Dpto 144",
"storeId": "Li4eEa3W2hiuGGCFa",
"isToStore": false,
"isRoundTrip": false,
"externalId": "P13G3",
"tipAmount": 1000,
"placeName": "Javier Perez",
"placePhone": "+56956385416",
"expectedDate": "2020-04-17T22:15:26Z",
"contents": [
{
"quantity": 1,
"name": "Pizza",
"description": "Extras: Bebida 1.5lt",
"unitPrice": 1000
}
]
}
Respuesta
{
"status": "ok",
"data": {
<Delivery>
}
}
Authorizations
Body
- Option 1
- Option 2
Fecha de retiro en el primer punto. Opcional. Formato ISO_8601. Si es para lo antes posible no enviar nada en este campo.
Cuando este flag está activo, en lugar de usar primero la addressLine1 y las coordenadas como respaldo, solo usaremos las coordenadas, y con ellas obtendremos el placeId más cercano (puede estar a 10 o 15 metros de distancia. Pueden surgir casos más extremos). en zonas más rurales o en países con menor densidad de población). Si se especifica el argumento maxDistance y es diferente de 300 metros, se usa; de lo contrario, usaremos una distancia máxima de 5000 metros. Valor predeterminado, falso.
Cuando no se usa un placeId, tenemos que buscar una ubicación para el despacho. Se intenta utilizando el addressLine1 y los resultados que se obtienen se ordenan por distancia al punto [latitude,longitude] y se retorna el más cercano. Si la distancia de todos los resultados es superior a maxDistance (ó 300mt si el parámetro no se especifica), se descartan todos y se busca la ubicación más cercana al punto. Si se hacen dos llamadas con el mismo addressLine1, latitude y longitude, la ubicación del despacho será la misma, aunque tengan diferencias en maxDistance. Si se necesita forzar un cambio, sugerimos hacer un cambio menor de la latitud o longitud para forzar el recalculo. Opcional, solo necesario si no se especifica placeId. Si no se especifica, se usarán 300mt como distancia máxima.
Definir el tipo de vehículo necesario para delivery special. El definir el tipo de vehículo puede afectar los tiempos de despacho. Esta opción está disponible por marca. Los valores posibles son walk, bike, ebike, moto, car. Opcional.
walk, bike, ebike, moto, car Cuando este flag se encuentra activo se utilizará el parámetro externalId como un identificador de idempotencia en los sistemas de Justo. Esto significa que se podrá generar un y sólo un delivery con el mismo externalId. Si este flag se encuentra activo y se intenta generar un nuevo delivery con un externalId que ya había sido utilizado previamente, se retornará la información del delivery anteriormente generado y no creará uno nuevo. Opcional (defecto false).
Response
success
Estado del pedido. Puede tomar los siguientes valores:
canceled: Pedido cancelado.pending: Pedido pendiente.scheduled: Pedido programado.active: En camino a buscar el pedido.delivering: En proceso de entrega.done: Pedido completado.Dispatch not completed: No se pudo completar el pedido. En el campo uncompletedReason podrá encontrar el motivo porque no se pudo completar la entrega.error: Error en el pedido.
canceled, pending, scheduled, active, delivering, done, Dispatch not completed, error