You will get your api key from questtag account. Go to Account Info, there you will find api key option. But to get api key visible you have to put your account password.
https://dispatch.questtag.com/Orders
POST
The api is secured with HTTP Basic authentication. While making the request, you need to send 'Basic API_KEY' value with Authorization key in the request header.
"Authorization": "Basic xxxxxxxxxx.XXXXXXXXXXXXXXXXXXXX"
The following parameters are mandatory to insert an order. You need to send each of them with correct data type.
Field Name | Data Type | Example |
---|---|---|
orderNumber | numeric | 2224 |
customerName | String | Qt Customer |
customerAddress | String | 8400 London Place Washington |
customerEmail | String | qtcustomer@yahoo.com |
customerPhoneNumber | String | +1222222 |
restaurantName | String | KFC |
restaurantAddress | String | 8400 London Place Washington |
Apart from these required field, you can also send the following optional field in your data param to track different status of your order (i.e. total cost, order item etc)
Field Name | Data Type | Example |
---|---|---|
orderItem | String |
[ { "name":"burger", "unitPrice":33, "quantity":2, "addOns": ["cheese","sauce"], "detail": "Last time too much sauce" }, { "name":"pizza", "unitPrice":50, "quantity":2 } ] |
restaurantPhoneNumber | String | +22345 |
expectedDeliveryDate | Date(yyyy-MM-dd) | 2017-06-13 |
expectedPickupTime | Time(HH:mm:ss) | 17:45:00 |
expectedDeliveryTime | Time(HH:mm:ss) | 17:45:00 |
orderSource | String | Seamless |
deliveryFee | numeric | 5.5 |
tips | numeric | 2 |
discountAmount | numeric | 3.3 |
tax | numeric | 4 |
totalOrderCost | numeric | 46 |
clientRestaurantId | numeric | 12 |
deliveryInstruction | String | knock knock |
paymentMethod | String | ‘cash’ or ‘credit card’ |
creditCardType | String | ‘visa’, ‘master card’, ‘AMEX’, ’other’ |
creditCardId | numeric (last 4 digit) | 1234 |
While constructing the data params for this api request, remember the following details :-
Status : 201 Created
Body :
{
"success": true,
"orderId": 118
}
Status : 401 Unauthorized
Body :
{
"success": false,
"response": "Authentication failed"
}
Status : 400 Bad Request
Body :
{
"success": false,
"response": "Required parameter not found"
}
Status : 400 Bad Request
Body :
{
"success": false,
"response": "restaurant address must be valid"
}
Status : 500 Internal Server Error
Body :
{
"success": false,
"response": "Error in inserting order."
}
var item1 = {quantity:1,name:"Burgar",unitPrice:5.2,addOns:["more spicy", "large", "salty"]};
var item2 = {quantity:2,name:"Pizza",unitPrice:15.2,addOns:["more spicy", "large"]};
var itemn = {quantity:1,name:"Any",unitPrice:10,addOns:["more spicy"]};
var orderItem = [];
orderItem.push(item1);
orderItem.push(item2);
orderItem.push(itemn);
var data = new FormData();
data.append("orderNumber", "9998");
data.append("customerName", "Mr. Jhon");
data.append("customerAddress", "8400 London Place, Washington");
data.append("customerEmail", "jhon@yahoo.com");
data.append("customerPhoneNumber", "+12242423");
data.append("restaurantName", "KFC");
data.append("restaurantAddress", "8400 London Place, Washington");
data.append("orderItem",JSON.stringify(orderItem));
data.append("totalOrderCost", "38.06");
data.append("tax", "2.5");
data.append("tips", "0.56");
data.append("deliveryFee", "5.0");
data.append("deliveryInstruction", "fast");
var url = "https://dispatch.questtag.com/Orders";
var api_key = "xxxxxxxxxx.XXXXXXXXXXXXXXXXXXXX";
//Using jQuery
/*$.ajax({
url: url,
method: "POST",
data: data,
processData: false,
contentType: false,
crossDomain: true,
beforeSend: function(client) {
client.setRequestHeader('Authorization', "Basic " + api_key);
},
success: function(response) {
console.log(response);
},
error: function(response) {
alert('Please Try again Later!');
}
});*/
//Raw JavaScript
var request = new XMLHttpRequest();
request.open("POST", url);
request.onreadystatechange = function() {
if(this.readyState === 4 && this.status === 200) {
console.log(this.responseText);
}
};
request.setRequestHeader("Authorization", "Basic "+api_key);
request.send(data);
$url = 'https://dispatch.questtag.com/Orders';
$api_key = 'xxxxxxxxxx.XXXXXXXXXXXXXXXXXXXX';
//You will find it from "My Account" menu -> Api Key
//[give your account password and get it] in questtag
//account
$item1->name = "Burger";
$item1->unitPrice = 5;
$item1->quantity = 2;
$item1->addOns = json_encode(array("more spicy", "large", "salty"));
$item2->name = "Pzza";
$item2->unitPrice = 10;
$item2->quantity = 1;
$item2->addOns = json_encode(array("large", "salty"));
$itemn->name = "Any";
$itemn->unitPrice = 10;
$itemn->quantity = 1;
$itemn->addOns = json_encode(array("large"));
$itemList = json_encode(array($item1, $item2, $itemn));
$data = array(
'orderNumber' => 999,
'customerName' => 'Mr. Jhon',
'customerAddress' => '8400, London Place Washington',
'customerEmail' => 'jhon@gmail.com',
'customerPhoneNumber' => '+1222222',
'restaurantName' => 'KFC',
'restaurantAddress' => '8400, London Place Washington',
'restaurantPhoneNumber' => '+12222345',
'orderItem'=>$itemList,
'totalOrderCost'=>'38.06',
'tax'=>'2.5',
'tips'=>'0.56',
'deliveryFee'=>'5.0',
'deliveryInstruction'=>'fast'
);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($curl, CURLOPT_VERBOSE, true);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_FAILONERROR, true);
curl_setopt($curl, CURLOPT_SSLVERSION, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_SSL_ENABLE_ALPN, false);
curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($curl, CURLOPT_REFERER, $url);
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0');
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
"Authorization: Basic " . $api_key
));
$jsonResult = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
$result = json_decode($jsonResult);
var_dump($err);
echo "--------------------";
print_r($result);
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using Newtonsoft.Json;
public class Item
{
public String name;
public double unitPrice;
public int quantity;
public List addOns;
}
public class Program
{
public static void Main()
{
var url = "https://dispatch.questtag.com/Orders";
var api_key = "xxxxxxxxxx.XXXXXXXXXXXXXXXXXXXX";
//You will find it from "My Account" menu -> Api Key
//[give your account password and get it] in questtag
//account
var item1 = new Item
{
name = "Burger",
unitPrice =5,
quantity = 2,
addOns = new List{"more spicy", "large", "salty"}
};
var item2 = new Item
{
name = "Pizza",
unitPrice =10,
quantity = 1,
addOns = new List{"large", "salty"}
};
var itemn = new Item
{
name = "Any",
unitPrice =10,
quantity = 1,
addOns = new List{"large"}
};
List- itemList = new List
- ();
itemList.Add(item1);
itemList.Add(item2);
itemList.Add(itemn);
var jsonArray = JsonConvert.SerializeObject(itemList);
HttpClient client = new HttpClient();
var values = new Dictionary
{
{"orderNumber", "400"},
{"customerName", "CustNameHere"},
{"customerPhoneNumber", "+27823008054"},
{"customerEmail", "Client@Provider.com"},
{"customerAddress", "8400 London Place, Washington"},
{"restaurantName", "xxxxxxxxxxxxxx"},
{"restaurantAddress", "8400 London Place, Washington"},
{"restaurantPhoneNumber", "+27823008054"},
{"orderItem", jsonArray},
{"totalOrderCost", "15.29"},
{"tax", "0.89"},
{"tips", "0.45"},
{"deliveryFee", "5"},
{"deliveryInstruction", "fast"},
};
client.DefaultRequestHeaders.Add("Accept", "application/*+xml;version=5.1");
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", api_key);
var content = new FormUrlEncodedContent(values);
var response = client.PostAsync(@url, content);
var responseString = response.Result.Content.ReadAsStringAsync().Result;
Console.WriteLine(responseString.ToString());
}
}
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.message.BasicNameValuePair;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
public class Main {
private JSONObject sendPost() throws Exception {
JSONObject result =null;
try (CloseableHttpClient client = HttpClientBuilder.create().build()) {
//used jar libs are
//"commons-logging-1.2.jar","httpclient-4.5.6.jar","httpcore-4.4.10.jar","json-simple-1.1.jar"
String url = "https://dispatch.questtag.com/Orders";
String api_key ="xxxxxxxxxx.XXXXXXXXXXXXXXXXXXXX";
JSONObject item1 = new JSONObject();
item1.put("quantity",1);
item1.put("name","Burger");
item1.put("unitPrice",5.2);
JSONArray addOns1 = new JSONArray();
addOns1.add("more spicy");
addOns1.add("large");
addOns1.add("salty");
item1.put("addOns",addOns1);
JSONObject item2 = new JSONObject();
item2.put("quantity",3);
item2.put("name","Pizza");
item2.put("unitPrice",15.2);
JSONArray addOns2 = new JSONArray();
addOns2.add("more spicy");
addOns2.add("large");
item2.put("addOns",addOns2);
JSONObject itemn = new JSONObject();
itemn.put("quantity",2);
itemn.put("name","Any");
itemn.put("unitPrice",10);
JSONArray addOns3 = new JSONArray();
addOns3.add("more spicy");
itemn.put("addOns",addOns3);
JSONArray itemList = new JSONArray();
itemList.add(item1);
itemList.add(item2);
itemList.add(itemn);
List params = new ArrayList();
params.add(new BasicNameValuePair("orderNumber", "99999"));
params.add(new BasicNameValuePair("customerName", "Mr. Jhon"));
params.add(new BasicNameValuePair("customerAddress", "8400, London Place Washington"));
params.add(new BasicNameValuePair("customerEmail", "jhon@gmail.com"));
params.add(new BasicNameValuePair("customerPhoneNumber", "+1222222"));
params.add(new BasicNameValuePair("restaurantName", "KFC"));
params.add(new BasicNameValuePair("restaurantAddress", "8400, London Place Washington"));
params.add(new BasicNameValuePair("restaurantPhoneNumber", "+12222345"));
params.add(new BasicNameValuePair("orderItem", itemList.toJSONString()));
params.add(new BasicNameValuePair("totalOrderCost", "38.06"));
params.add(new BasicNameValuePair("tax", "2.5"));
params.add(new BasicNameValuePair("tips", "0.56"));
params.add(new BasicNameValuePair("deliveryFee", "5.0"));
params.add(new BasicNameValuePair("deliveryInstruction", "fast"));
HttpPost request = new HttpPost(url);
request.setEntity(new UrlEncodedFormEntity(params, "UTF-8"));
request.setHeader("Authorization","Basic "+api_key);
HttpResponse response = client.execute(request);
BufferedReader bufReader = new BufferedReader(new InputStreamReader(
response.getEntity().getContent()));
StringBuilder builder = new StringBuilder();
String line;
while ((line = bufReader.readLine()) != null) {
builder.append(line);
builder.append(System.lineSeparator());
}
String responses = builder.toString();
JSONParser jsonParser = new JSONParser();
result = (JSONObject) jsonParser.parse(responses);
System.out.println(result.toJSONString());
}
return result;
}
public static void main(String[] args) {
Main main = new Main();
try {
main.sendPost();
} catch (Exception e) {
e.printStackTrace();
}
}
}
import requests
import json
url = 'https://dispatch.questtag.com/Orders';
api_key = 'xxxxxxxxxx.XXXXXXXXXXXXXXXXXXXX';
item1 = {'quantity':1,'name':'Burgar','unitPrice':5.2,'addOns':['more spicy', 'large', 'salty']};
item2 = {'quantity':2,'name':'Pizza','unitPrice':15.2,'addOns':['more spicy', 'large']};
itemn = {'quantity':1,'name':'Any','unitPrice':10,'addOns':['more spicy']};
itemList = [];
itemList.append(item1);
itemList.append(item2);
itemList.append(itemn);
items = json.dumps(itemList);
data = { 'orderNumber': 9999,
'customerName' : 'Mr. Jhon',
'customerAddress' : '8400, London Place Washington',
'customerEmail': 'jhon@gmail.com',
'customerPhoneNumber': '+1222222',
'restaurantName': 'KFC',
'restaurantAddress': '8400, London Place Washington',
'restaurantPhoneNumber': '+12222345',
'orderItem':items,
'totalOrderCost':'38.06',
'tax':'2.5',
'tips':'0.56',
'deliveryFee':'5.0',
'deliveryInstruction':'fast'};
headers = {'Authorization': 'Basic '+api_key};
r = requests.post(url,data = data,headers = headers);
reponse= r.json();
print(reponse);
https://dispatch.questtag.com/delegateOrder
POST
The api is secured with HTTP Basic authentication. While making the request, you need to send 'API_KEY' value with Authorization key in the request header.
"Authorization": "xxxxxxxxxx.XXXXXXXXXXXXXXXXXXXX"In this way, you have to cooperate with us to describe your data detail and make a good mapper. Thanks.
Status : 200 OK
Body :
{
"success": true,
"message": "Order has been successfully placed in your system"
}
Status : 401 Unauthorized
Body :
{
"success": false,
"message":"Your request is successfully placed. But System did not get authentication api key in request header with key ||Authorization||. Please check your api key on dispatch account in ||My Account|| menu. Thanks",
"Authentication":false
}
Status : 200 OK
Body :
{
"success": false,
"message":"Your request is successfully placed. But system have got authentication api key but it is not correct. Please check your api key on dispatch account in ||My Account|| menu.Thanks",
"Authentication":false
}
Status : 200 OK
Body :
{
"success": false,
"message":"Your request is successfully placed. But your data placement is not ok. You must have to place data as RAW JSON format or Form Data with key ||order_data||",
"Authentication":true,
"Data Receive":false
}
Status : 200 OK
Body :
{
"success": true,
"message":"Your request is successfully placed. We got RAW JSON data and congratulation you have successfully complete the integration process.
Your side is done now wait for a bit, your will get an email about completion of integration process within two days.
we have attached the data you have posted. please let us know on email if your data is not ok or similar as you posted.Thanks",
"Authentication":true,
"Data Receive":true,
"Data":"Your data is :-> given data"
}
https://dispatch.questtag.com/Orders/:order_id
DELETE
The api is secured with HTTP Basic authentication. While making the request, you need to send 'Basic {API_KEY}:{API_SECRET}' in the Authorization header.
Status : 200 OK
Body :
{
"success": true,
"response": "order deleted"
}
Status : 401 Unauthorized
Body :
{
"success": false,
"response": "Auth failed"
}
Status : 403 Forbidden
Body :
{
"success": false,
"response": "You are not authorized to do this action"
}
Status : 200 OK
Body :
{
"success": false,
"response": "order not found"
}
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("DELETE", "https://dispatch.questtag.com/Orders/122");
xhr.setRequestHeader("authorization", "Basic XXXXXXXXXXXXXXXXXXXX");
xhr.send();
$orderId = 129;
$url = 'https://dispatch.questtag.com/Orders/' . $orderId;
$username = 'XXXXXXX';
$password = 'XXXXXXX';
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, $username . ":" . $password);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
/**
*To trigger curl error on http error. Set
*curl_setopt($curl, CURLOPT_FAILONERROR, true);
*But the following way is preferable as it will let you see the cause of the error.
*/
$jsonResult = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
$result = json_decode($jsonResult);
if ($err) {
echo "cURL Error #:" . $err;
} else {
if ($result->success) {
echo $result->orderId;
} else {
echo $result->response;
}
}
https://api.questtag.com/orders
GET
The api is secured with HTTP Basic authentication. While making the request, you need to send 'Basic API_KEY' value with Authorization key in the request header.
"Authorization": "Basic xxxxxxxxxx.XXXXXXXXXXXXXXXXXXXX"
Status : 200 OK
Body :
[
{
"orderId": 22773,
"orderNumber": "75637",
"companyId": 409,
"areaId": 406,
"customer": {
"name": "Hello",
"address": "CB-18, Old Kachukeht, Dhaka - 1206",
"phoneNumber": "+8801555552505",
"emailAddress": "",
"latitude": 23.810332,
"longitude": 90.4125181
},
"restaurant": {
"name": "Bfc",
"address": "Mirpur 10 Roundabout, Dhaka, Bangladesh",
"phoneNumber": "",
"latitude": 23.8069245,
"longitude": 90.36869779999999
},
"distance": 2.780024563379714,
"activityLog": {
"placementTime": "2019-12-07T05:48:05",
"expectedPickupTime": "06:15",
"expectedDeliveryDate": "2019-12-07",
"expectedDeliveryTime": "06:45",
"assignedTime": null,
"startTime": null,
"pickedUpTime": null,
"arrivedTime": null,
"deliveryTime": null
},
"costing": {
"totalCost": 800.0,
"deliveryFee": 0.0,
"tip": 0.0,
"discountAmount": 0.0,
"tax": 0.0,
"cashTip": 0.0
},
"paymentMethod": "CASH",
"orderItems": null,
"assignedCarrierId": null,
"orderStatus": {
"incomplete": true,
"accepted": false,
"orderState": "INCOMPLETE"
}
}
]
https://api.questtag.com/orders/{orderNumber}
GET
The api is secured with HTTP Basic authentication. While making the request, you need to send 'Basic API_KEY' value with Authorization key in the request header.
"Authorization": "Basic xxxxxxxxxx.XXXXXXXXXXXXXXXXXXXX"
Status : 200 OK
Body :
[
{
"orderId": 20625,
"orderNumber": "7568",
"companyId": 409,
"areaId": 406,
"customer": {
"name": "kawnayeen",
"address": "173A, East Kafrul, Dhaka - 1206",
"phoneNumber": "+880155555555",
"emailAddress": "okay@questtag.com",
"latitude": 23.7875632,
"longitude": 90.3874568
},
"restaurant": {
"name": "Bfc",
"address": "Mirpur 10 Roundabout, Dhaka, Bangladesh",
"phoneNumber": "",
"latitude": 23.8069245,
"longitude": 90.36869779999999
},
"distance": 1.7877279555477452,
"activityLog": {
"placementTime": "2019-11-29T11:43:59",
"expectedPickupTime": "12:12",
"expectedDeliveryDate": "2019-11-29",
"expectedDeliveryTime": "12:42",
"assignedTime": null,
"startTime": "2019-11-30T13:41:07",
"pickedUpTime": "2019-12-01T05:43:15",
"arrivedTime": "2019-12-01T05:43:15",
"deliveryTime": "2019-12-01T05:43:15"
},
"costing": {
"totalCost": 582.4,
"deliveryFee": 0.0,
"tip": 0.0,
"discountAmount": 0.0,
"tax": 22.4,
"cashTip": 0.0
},
"paymentMethod": "CASH",
"orderItems": [
{
"name": "Super Cheese Burger",
"quantity": 2,
"unitPrice": 280.0
}
],
"assignedCarrierId": -1,
"orderStatus": {
"incomplete": false,
"accepted": true,
"orderState": "ALREADY_DELIVERED"
}
}
]
https://api.questtag.com/orders/assign/{orderId}/{carrierId}
PUT
The api is secured with HTTP Basic authentication. While making the request, you need to send 'Basic API_KEY' value with Authorization key in the request header.
"Authorization": "Basic xxxxxxxxxx.XXXXXXXXXXXXXXXXXXXX"
Status : 200 OK
Body :
{
"success": true,
"response": "assignment successful"
}
https://api.questtag.com/carriers
GET
The api is secured with HTTP Basic authentication. While making the request, you need to send 'Basic API_KEY' value with Authorization key in the request header.
"Authorization": "Basic xxxxxxxxxx.XXXXXXXXXXXXXXXXXXXX"
Status : 200 OK
Body :
[
{
"id": 969,
"personalId": null,
"name": "kawnayeen",
"codeName": "",
"phoneNumber": "+8801555555405",
"companyId": 409,
"areaId": 406,
"isOnShift": false,
"email": "okay@questtag.com"
}
]
https://api.questtag.com/carriers
POST
The api is secured with HTTP Basic authentication. While making the request, you need to send 'Basic API_KEY' value with Authorization key in the request header. "Authorization": "Basic xxxxxxxxxx.XXXXXXXXXXXXXXXXXXXX"
Status : 201 Created
Body :
{
"email": "kamarul@cefalo.com",
"password": "ab7b71a1",
"message": "You should update your auto generated password"
}
Status : 202 Accepted
Body :
{
"email": "kamarul@questtag.com",
"password": null,
"message": "Activated already existing carrier. should be able to login with existing password"
}
Status : 400 Bad Request
Body :
{
"errorMessage": "Already an active carrier in your company"
}
https://api.questtag.com/carriers/{carrierId}
DELETE
The api is secured with HTTP Basic authentication. While making the request, you need to send 'Basic API_KEY' value with Authorization key in the request header. "Authorization": "Basic xxxxxxxxxx.XXXXXXXXXXXXXXXXXXXX"
Status : 204 No Content
Body :
Status : 401 Unauthorized
Body :
{
"errorMessage": "You are not authorized to perform this operation"
}
Status : 400 - Bad Request
Body :
{
"errorMessage": "you need to end current shift before deleting"
}