#
Estimations
#
Introduction
To provide users with a convenient solution, we've implemented an endpoint designed to offer estimations for both time and fees. This allows users to gauge potential costs and delivery times without the need to initiate the order creation process.
#
Note
To test your work on the sandbox or staging API, please refer to the Environments section for detailed instructions.
#
Estimation based on real-time driver location
This request will return the estimation based on the actual locations of the drivers that are near the branch.
To try the estimation, you will need to make an HTTP POST request to the following endpoint:
https://staging.armadadelivery.com/v0/deliveries/estimate
https://api.armadadelivery.com/v0/deliveries/estimate
The body of the request should be in JSON format and include the following parameters:
branch
: Branch ID, The origin point String - Requireddestination
: Customer destination Object - Requiredlatitude
: Float - Requiredlongitude
: Float - Required
#
Request Example
curl --location --request POST 'https://api.armadadelivery.com/v0/deliveries/estimate' \
--header 'Authorization: Key [YOUR API KEY]' \
--header 'Content-Type: application/json' \
--data-raw '{
"branch": "5eef2043bfa02f001c17b229",
"destination": {
"latitude": 29.3300,
"longitude": 47.9085,
}
}'
fetch('https://api.armadadelivery.com/v0/deliveries/estimate', {
method: 'POST',
headers: {
'Authorization': 'Key [YOUR API KEY]',
'Content-Type': 'application/json'
},
body: JSON.stringify({
branch: "5eef2043bfa02f001c17b229",
destination: {
latitude: 29.3300,
longitude: 47.9085,
}
})
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
func main() {
url := "https://api.armadadelivery.com/v0/deliveries/estimate"
requestBody, err := json.Marshal(map[string]interface{}{
"branch": "5eef2043bfa02f001c17b229",
"destination": map[string]float64{
"latitude": 29.3300,
"longitude": 47.9085,
},
})
if err != nil {
fmt.Println("Error in JSON marshal:", err)
return
}
req, err := http.NewRequest("POST", url, bytes.NewBuffer(requestBody))
if err != nil {
fmt.Println("Error creating request:", err)
return
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Key [YOUR API KEY]")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Error sending request:", err)
return
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println("Error reading response body:", err)
return
}
fmt.Println(string(body))
}
#
Response Schema
{
deliveryFee: Number,
pickupEta: ISODATE || null,
deliveryEta: ISODATE || null,
}
Eta: Estimated Arrival time
#
Response Example
{
deliveryFee: 17,
pickupEta: "2024-01-18T14:48:00.000Z",
deliveryEta: "2024-01-18T15:39:00.000Z"
}
pickupEta
and deliveryEta
may be null
if no driver is available. Just try again later.
If you want to achieve good results, input real data, Test it in the production environment.
#
Timeless Estimation
This request will return the estimation not based on real-time driver locations.
To try the estimation, you will need to make an HTTP POST request to the following endpoint:
https://staging.armadadelivery.com/v0/deliveries/timelessEstimate
https://api.armadadelivery.com/v0/deliveries/timelessEstimate
The body of the request should be in JSON format and include the following parameters:
branch
: Branch ID, The origin point String - Requireddestination
: Customer destination Object - Requiredlatitude
: Float - Requiredlongitude
: Float - Required
#
Request Example
curl --location --request POST 'https://api.armadadelivery.com/v0/deliveries/timelessEstimate' \
--header 'Authorization: Key [YOUR API KEY]' \
--header 'Content-Type: application/json' \
--data-raw '{
"branch": "5eef2043bfa02f001c17b229",
"destination": {
"latitude": 29.3300,
"longitude": 47.9085,
}
}'
fetch('https://api.armadadelivery.com/v0/deliveries/timelessEstimate', {
method: 'POST',
headers: {
'Authorization': 'Key [YOUR API KEY]',
'Content-Type': 'application/json'
},
body: JSON.stringify({
branch: "5eef2043bfa02f001c17b229",
destination: {
latitude: 29.3300,
longitude: 47.9085,
}
})
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
func main() {
url := "https://api.armadadelivery.com/v0/deliveries/timelessEstimate"
requestBody, err := json.Marshal(map[string]interface{}{
"branch": "5eef2043bfa02f001c17b229",
"destination": map[string]float64{
"latitude": 29.3300,
"longitude": 47.9085,
}
})
if err != nil {
fmt.Println("Error in JSON marshal:", err)
return
}
req, err := http.NewRequest("POST", url, bytes.NewBuffer(requestBody))
if err != nil {
fmt.Println("Error creating request:", err)
return
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Key [YOUR API KEY]")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Error sending request:", err)
return
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println("Error reading response body:", err)
return
}
fmt.Println(string(body))
}
#
Response Schema
{
deliveryFee: Number,
totalDeliveryDuration: Number,
durationToPickup: Number
}
#
Response Example
{
deliveryFee: 17,
totalDeliveryDuration: 1950,
durationToPickup: 975
}