Copy link to clipboard
Copied
Awesome job on getting us a way to Consume the API from the front end. This is what I needed to get a project I have been working on where I can use BC. I would love to have a way to do POST PUT and DELETE but I'll take what I can get for now. I will use the Webforms for that for now.
This allows me to use Modern Dev frameworks like Angular, etc much easier and is a big win for the way I like to Design and Develop.
I create html pages with the Module_Data tag for each part of my API (i.e):
get-customers.html
{module_data resource="customers" version="v3" fields="id,firstName,middleName,lastName" skip="0" limit="10" order="id" collection="customerData"}
then call a function in in my Angular Controller or Service:
function getCustomers() {
$http.get('/app/api/get-customers.html?json=true').
success(function(data, status, headers, config) {
// this callback will be called asynchronously
// when the response is available
$log.debug(data);
}).
error(function(data, status, headers, config) {
// called asynchronously if an error occurs
// or server returns response with an error status.
});
}
Super Easy.
Thank you very much!
Richard Oren
Copy link to clipboard
Copied
Just as a note Richard - top limit of data is 500 per pagination set. Keep that in mind.
Also - Look at the liquid options first, lots of cases where you wont need to the javascript solution now.
Copy link to clipboard
Copied
Will do - Thank for the tips Liam.