-
Notifications
You must be signed in to change notification settings - Fork 0
APIs
- Zomato
- Tripadvisor
- [JustEat] (#justeat)
API not publicly open, but scraped from Scoot app -
private void fetchOla(String lat, String lng) {
ApplicationTaxi.getInstance().addToRequestQueue(new AnonymousClass_15(new StringBuilder("http://mapi.olacabs.com/v3/cab/info?custom_lat=").append(lat).append("&custom_lng=").append(lng).append("&accuracy=10.0&fix_time=1414867768827&speed=0.0&altitude=0.0&location_type=CUSTOM&selected_by=USER&cab_category=economy_sedan&user_id=z%2FSOjdAeOaXpiu3YGpZbX4yan5NjzSyoFQ3bMhayj%2FLK11hcaHYppAIW6bxl%0AU%2BVT64RfuNjRmCF8em1tgbyD3g%3D%3D%0A++++&enable_auto=true&enable_delivery=true").toString(), new Listener<String>() {
public void onResponse(String response) {
VolleyLog.v("Response:%n %s", response);
ActivityHome.this.rlLoading.setVisibility(DetectedActivity.RUNNING);
try {
int i;
TaxiProviderObject t;
JSONObject resp = new JSONObject(response);
JSONArray catNames = resp.optJSONArray("city_taxi_categories");
HashMap<String, String> catNameMap = new HashMap();
for (i = 0; i < catNames.length(); i++) {
JSONObject jobj = catNames.optJSONObject(i);
if (jobj != null) {
catNameMap.put(jobj.getString("id"), jobj.getString("display_name"));
}
}
JSONArray jarr = resp.optJSONArray("cab_categories");
ArrayList<TaxiProviderObject> tempList = new ArrayList();
boolean z = false;
for (i = 0; i < jarr.length(); i++) {
jobj = jarr.optJSONObject(i);
if (jobj != null) {
t = new TaxiProviderObject();
if (jobj.optBoolean("cab_availability")) {
z = true;
t.time = new StringBuilder(String.valueOf(jobj.optJSONObject("duration").optInt("value"))).append(" mins").toString();
t.name = jobj.optString("display_name");
t.type = 3;
tempList.add(t);
}
}
}
if (z) {
t = new TaxiProviderObject();
t.isheader = true;
t.name = "Ola Cabs";
ActivityHome.this.list.add(t);
ActivityHome.this.list.addAll(tempList);
}
ActivityHome.this.adapter.notifyDataSetChanged();
ActivityHome.this.showNoCabs();
} catch (Exception e) {
e.printStackTrace();
}
}
}, new ErrorListener() {
public void onErrorResponse(VolleyError error) {
ActivityHome.this.rlLoading.setVisibility(DetectedActivity.RUNNING);
ActivityHome.this.alert("Connection Error");
}
}));
}
private void fetchMeru(String lat, String lng) {
ApplicationTaxi.getInstance().addToRequestQueue(new StringRequest(new StringBuilder("http://mobileapp.merucabs.com/NearByCab_ETA/GetNearByCabs.svc/rest/nearby?Lat=").append(lat).append("&Lng=").append(lng).append("&SuggestedRadiusMeters=5000&CabMaxCount=10").toString(), new Listener<String>() {
public void onResponse(String response) {
ActivityHome.this.rlLoading.setVisibility(DetectedActivity.RUNNING);
VolleyLog.v("Response:%n %s", response);
Log.d("meru", response);
try {
String str = response;
JSONArray jarr = new JSONObject(str.substring(response.indexOf("{"), response.lastIndexOf("}") + 1)).optJSONArray("Cablist");
boolean z = false;
Set<String> typeSet = new HashSet();
ArrayList<TaxiProviderObject> lst = new ArrayList();
for (int i = 0; i < jarr.length(); i++) {
TaxiProviderObject t;
JSONObject jobj = jarr.optJSONObject(i);
if (jobj != null && !typeSet.contains(jobj.optString("Brand"))) {
t = new TaxiProviderObject();
String eta = jobj.optString("TrafficETA");
if (eta != null && eta.length() > 0 && Integer.parseInt(eta) > 0) {
t.name = jobj.optString("Brand");
t.time = new StringBuilder(String.valueOf(eta)).append(" mins").toString();
t.type = 4;
lst.add(t);
typeSet.add(t.name);
z = true;
}
}
}
if (z) {
t = new TaxiProviderObject();
t.isheader = true;
t.name = "Meru Cabs";
ActivityHome.this.list.add(t);
ActivityHome.this.list.addAll(lst);
}
ActivityHome.this.adapter.notifyDataSetChanged();
ActivityHome.this.showNoCabs();
} catch (Exception e) {
e.printStackTrace();
}
}
}, new ErrorListener() {
public void onErrorResponse(VolleyError error) {
ActivityHome.this.rlLoading.setVisibility(DetectedActivity.RUNNING);
ActivityHome.this.alert("Connection Error");
}
}));
}
No public API, but as scraped from Scoot App -
private void fetchTaxiSureNew(String lat, String lng) {
ApplicationTaxi.getInstance().addToRequestQueue(new StringRequest(new StringBuilder("http://iospush.taxiforsure.com/getNearestDriversForApp/?longitude=")
.append(lng).append("&latitude=")
.append(lat).append("&density=320&appVersion=4.1.1")
.toString(), new Listener<String>() {
public void onResponse(String response) {
ActivityHome.this.rlLoading.setVisibility(DetectedActivity.RUNNING);
VolleyLog.v("Response:%n %s", response);
try {
JSONArray jarr = new JSONObject(response).optJSONObject("response_data").optJSONArray("data");
if (jarr != null && jarr.length() > 0) {
TaxiProviderObject t = new TaxiProviderObject();
t.isheader = true;
t.name = "Taxi for Sure";
ActivityHome.this.list.add(t);
}
Set<String> typeSet = new HashSet();
for (int i = 0; i < jarr.length(); i++) {
JSONObject jobj = jarr.optJSONObject(i);
if (jobj != null && !typeSet.contains(jobj.optString("carType"))) {
t = new TaxiProviderObject();
t.name = jobj.optString("carType");
t.time = new StringBuilder(String.valueOf(jobj.optInt("duration"))).append(" mins").toString();
t.type = 1;
ActivityHome.this.list.add(t);
typeSet.add(t.name);
}
}
ActivityHome.this.adapter.notifyDataSetChanged();
ActivityHome.this.showNoCabs();
} catch (Exception e) {
e.printStackTrace();
}
}
}, new ErrorListener() {
public void onErrorResponse(VolleyError error) {
ActivityHome.this.rlLoading.setVisibility(DetectedActivity.RUNNING);
ActivityHome.this.alert("Connection Error");
}
}));
}
##Bus ###Travelyaari http://api.mantistechnologies.com/service.asmx
###eTravelSmart http://www.etravelsmart.com/bus/busApi.htm
API Documentation API Publicly documented, but API keys not given to individual developers, only to firms making apps.
Content API NOTE: Have to check if Indian restaurants data is available.
https://github.com/justeat/JustEat.RecruitmentTest
http://api.just-eat.com/swagger-ui/
###Foodpanda http://api.foodpanda.com/ - Not documented much, have to decompile app
https://www.mashape.com/devru/book-my-show - Unofficial API
#####Official API
Get list of events
http://data-in.bookmyshow.com/?cmd=GETEVENTLIST&f=json&cc&et=MT&dt<=28.7312&lg=77.1212&rc&sr&t=67x1xa33b4x422b361ba
et = MT for movies
et = CT for concerts
et = SP for Sports
et = PL for Plays
https://developers.explara.com/get-started - Official