Skip to content

Instantly share code, notes, and snippets.

@bachya
Created September 15, 2020 23:54
Show Gist options
  • Save bachya/90285e50641babed4e74ec8ff85127e0 to your computer and use it in GitHub Desktop.
Save bachya/90285e50641babed4e74ec8ff85127e0 to your computer and use it in GitHub Desktop.
SmartInsure Shopify API Example
jQuery.ajax({
url: "...",
type: "GET",
data: {
"address": "<ADDRESS>",
},
headers: {
"Content-Type": "application/json; charset=utf-8",
"x-api-key": "...",
},
})
.done(function(data, textStatus, jqXHR) {
console.log("HTTP Request Succeeded: " + jqXHR.status);
console.log(data);
})
.fail(function(jqXHR, textStatus, errorThrown) {
console.log("HTTP Request Failed");
})
.always(function() {
/* ... */
});
jQuery.ajax({
url: "...",
type: "POST",
headers: {
"Content-Type": "application/json; charset=utf-8",
"x-api-key": "...",
},
contentType: "application/json",
data: JSON.stringify({
"floors": <INTEGER>
"washing_machines": <INTEGER>
"bathrooms": <INTEGER>
"entry_doors": <INTEGER>
"windows": <INTEGER>
"bedrooms": <INTEGER>
"kitchens": <INTEGER>
"square_footage": <INTEGER>
"total_rooms": <INTEGER>
"outdoor_zones": <INTEGER>
})
})
.done(function(data, textStatus, jqXHR) {
console.log("HTTP Request Succeeded: " + jqXHR.status);
console.log(data);
})
.fail(function(jqXHR, textStatus, errorThrown) {
console.log("HTTP Request Failed");
})
.always(function() {
/* ... */
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment