Alex Billson (@pielegacy)
The Frozen Oak is a revolution in beverages and being the forward thinking company that Oak is it was only right that an associated Frozen Oak Locator was developed. This locator is powered by a versatile, simple, insecure API that can be used to query store locations easily.
All Frozen Oak Locations can be queried with a GET request to;
https://www.frozenoak.com.au/wp-admin/admin-ajax.php
Note that a blank search will respond with the value 0
, we need
to apply URI parameters in order to get some meaningful data;
Parameter | Required? | Description | Example |
---|---|---|---|
action |
Yes | The action to take, currently only store_search seems to do anything |
action=store_search |
autoload |
Yes | No clue what this does, but it always is required and needs to be 1 |
autoload=1 |
lat |
Yes | The latitude of your location as a floating point number | lat=-25.274398 |
lng |
Yes | The longitude of your location as a floating point number | lng=133.77513599999997 |
max_results |
No | The maximum results you want back, is optional. | max_results=150 |
search_radius |
No | The radius in kilometres of Starmarts you wish to include in your geo-search | search_radius=10 |
The payload for any Frozen Oak query will return an array of the following object;
{
"address": "1/75 Mount Derrimut Rd",
"store": "Caltex Star Mart Mt Derrimut",
"thumb": "",
"id": "531",
"address2": "",
"city": "Deer Park",
"state": "VIC",
"zip": "3023",
"country": "Australia",
"lat": "-37.781578",
"lng": "144.773575",
"phone": "",
"fax": "",
"email": "",
"hours": "",
"url": "",
"dater": "20171019",
"dater_text": "Thu Oct 19 2017 6PM",
"hour": "18",
"coming": ""
}
All the fields are pretty self explanatory with the context of the URL parameters.
Using QuickType.io I have generated the following types for the Oak API.
export interface FrozenOak {
address: string;
store: string;
thumb: string;
id: string;
address2: string;
city: string;
state: string;
zip: string;
country: string;
lat: string;
lng: string;
phone: string;
fax: string;
email: string;
hours: string;
url: string;
dater: string;
dater_text: string;
hour: string;
coming: string;
}
public class FrozenOak
{
[JsonProperty("address")]
public string Address { get; set; }
[JsonProperty("store")]
public string Store { get; set; }
[JsonProperty("thumb")]
public string Thumb { get; set; }
[JsonProperty("id")]
public string Id { get; set; }
[JsonProperty("address2")]
public string Address2 { get; set; }
[JsonProperty("city")]
public string City { get; set; }
[JsonProperty("state")]
public string State { get; set; }
[JsonProperty("zip")]
public string Zip { get; set; }
[JsonProperty("country")]
public string Country { get; set; }
[JsonProperty("lat")]
public string Lat { get; set; }
[JsonProperty("lng")]
public string Lng { get; set; }
[JsonProperty("phone")]
public string Phone { get; set; }
[JsonProperty("fax")]
public string Fax { get; set; }
[JsonProperty("email")]
public string Email { get; set; }
[JsonProperty("hours")]
public string Hours { get; set; }
[JsonProperty("url")]
public string Url { get; set; }
[JsonProperty("dater")]
public string Dater { get; set; }
[JsonProperty("dater_text")]
public string DaterText { get; set; }
[JsonProperty("hour")]
public string Hour { get; set; }
[JsonProperty("coming")]
public string Coming { get; set; }
}
public class FrozenOak {
private String address;
private String store;
private String thumb;
private String id;
private String address2;
private String city;
private String state;
private String zip;
private String country;
private String lat;
private String lng;
private String phone;
private String fax;
private String email;
private String hours;
private String url;
private String dater;
private String daterText;
private String hour;
private String coming;
public String getAddress() { return address; }
public void setAddress(String value) { this.address = value; }
public String getStore() { return store; }
public void setStore(String value) { this.store = value; }
public String getThumb() { return thumb; }
public void setThumb(String value) { this.thumb = value; }
public String getId() { return id; }
public void setId(String value) { this.id = value; }
public String getAddress2() { return address2; }
public void setAddress2(String value) { this.address2 = value; }
public String getCity() { return city; }
public void setCity(String value) { this.city = value; }
public String getState() { return state; }
public void setState(String value) { this.state = value; }
public String getZip() { return zip; }
public void setZip(String value) { this.zip = value; }
public String getCountry() { return country; }
public void setCountry(String value) { this.country = value; }
public String getLat() { return lat; }
public void setLat(String value) { this.lat = value; }
public String getLng() { return lng; }
public void setLng(String value) { this.lng = value; }
public String getPhone() { return phone; }
public void setPhone(String value) { this.phone = value; }
public String getFax() { return fax; }
public void setFax(String value) { this.fax = value; }
public String getEmail() { return email; }
public void setEmail(String value) { this.email = value; }
public String getHours() { return hours; }
public void setHours(String value) { this.hours = value; }
public String getUrl() { return url; }
public void setUrl(String value) { this.url = value; }
public String getDater() { return dater; }
public void setDater(String value) { this.dater = value; }
public String getDaterText() { return daterText; }
public void setDaterText(String value) { this.daterText = value; }
public String getHour() { return hour; }
public void setHour(String value) { this.hour = value; }
public String getComing() { return coming; }
public void setComing(String value) { this.coming = value; }
}
struct PurpleFrozenOak {
std::string address;
std::string store;
std::string thumb;
std::string id;
std::string address2;
std::string city;
std::string state;
std::string zip;
std::string country;
std::string lat;
std::string lng;
std::string phone;
std::string fax;
std::string email;
std::string hours;
std::string url;
std::string dater;
std::string dater_text;
std::string hour;
std::string coming;
};
type FrozenOak []PurpleFrozenOak
type PurpleFrozenOak struct {
Address string `json:"address"`
Store string `json:"store"`
Thumb string `json:"thumb"`
ID string `json:"id"`
Address2 string `json:"address2"`
City string `json:"city"`
State string `json:"state"`
Zip string `json:"zip"`
Country string `json:"country"`
Lat string `json:"lat"`
Lng string `json:"lng"`
Phone string `json:"phone"`
Fax string `json:"fax"`
Email string `json:"email"`
Hours string `json:"hours"`
URL string `json:"url"`
Dater string `json:"dater"`
DaterText string `json:"dater_text"`
Hour string `json:"hour"`
Coming string `json:"coming"`
}