Function to fetch Customer
fetchCustomer: function (domain_url, auth, id, wc_ck, wc_cs) {
var response = https.get({
url: domain_url + '/wp-json/wc/v2/customers/' + id + '?consumer_key=' + wc_ck + '&consumer_secret=' + wc_cs,
headers: {
authorization: auth
}
});
return JSON.parse(response.body);
}
Function to get the list of customers
listCustomers: function (domain_url, auth, wc_ck, wc_cs) {
var response = https.get({
url: domain_url + '/wp-json/wc/v2/customers' + '?consumer_key=' + wc_ck + '&consumer_secret=' + wc_cs,
headers: {
authorization: auth
}
});
return {
header: response.headers,
body: JSON.parse(response.body)
};
}
Function to fetch item
fetchItem: function (domain_url, auth, id, wc_ck, wc_cs) {
var response = https.get({
url: domain_url + '/wp-json/wc/v2/products/' + id + '?consumer_key=' + wc_ck + '&consumer_secret=' + wc_cs,
headers: {
authorization: auth
}
});
return JSON.parse(response.body);
}
Function to get the list of items
listItems: function (domain_url, auth, wc_ck, wc_cs) {
var response = https.get({
url: domain_url + '/wp-json/wc/v2/products' + '?consumer_key=' + wc_ck + '&consumer_secret=' + wc_cs,
headers: {
authorization: auth
}
});
return {
header: response.headers,
body: JSON.parse(response.body)
};
}