Skip to content

Instantly share code, notes, and snippets.

@jeffdonthemic
Last active August 16, 2019 17:53
Show Gist options
  • Save jeffdonthemic/7029a481d0333b8cf9800cf26b912c18 to your computer and use it in GitHub Desktop.
Save jeffdonthemic/7029a481d0333b8cf9800cf26b912c18 to your computer and use it in GitHub Desktop.
// create the association object with the final data
associations = {
"elements": elements
}
// create all of the associations
request({
url: 'https://api.clover.com:443/v3/merchants/'+process.env.CLOVER_MERCHANT_ID+'/category_items',
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer ' + _accessToken
},
body: JSON.stringify(associations)
}, function(error, response, body){
console.log('DEBUG[CLOVER]: Creating all associations for items in ' + categoryId + ' for ' + elements.length + ' items.');
if(error) {
console.log('ERROR[CLOVER]: Could not create all associations for category items in: '+categoryId);
console.log(error);
reject(error);
} else {
console.log('DEBUG[CLOVER]: Made clover callout to create all category association successfully for: '+categoryId);
resolve(true);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment