Build api URL with app.api.buildURL()

Have you ever tried making an api call from your javascript controller in sugar. How do you create your api url? Ever used app.api.buildURL() ? Any idea what are the parameters this method accepts? Don’t worry. Try it out when you write your next api call.

Use app.api.buildURL() to build url for your api calls. The method comes with four parameters as below.

/**
m - Module name.
e - End point name.
r - Object containing current record data. Eg: pass your current record id as {id:<current-recrod-id>}
p - Other parameters. Eg: limit of records,orderBy etc.
**/
app.api.buildURL(m,e,r,p);
view raw buildUrl.js hosted with ❤ by GitHub

Follow my blog to get  daily tips……:)


Leave a comment