Clone and edit this document
Runkit
Runkit
home page
user forum
new notebook
clone notebook
download notebook
support & documentation
log in
sign up
new notebook
help & feedback
clone this notebook
download this notebook
Sign In
Sign Up
moltinGateway.Product.UpdateRelationships
node v6.17.1
version:
1.0.0
endpoint
share
tweet
This is a playground to test JavaScript. It runs a completely standard copy of Node.js on a virtual server created just for you. Every one of npm’s 300,000+ packages are pre-installed, so try it out:
var moltin = require('@moltin/sdk'); var _fetch = fetch; fetch = function() { console.log(arguments); return _fetch.apply(this, arguments); }; var gateway = moltin.gateway({ client_id: 'Bo3sm8m9fQfvY9zCrfRhICCa4UbgimJw8HMGJnBBSq', client_secret: '5FZZYEFfHJEOKPGtUsqqmvdHquBody3w7W7BfZ2D7a' }); var productId = 'd7ca0989-e54c-40ca-8de3-9abb43233fe8'; var categories1 = [ '7c4c6530-b09b-4103-861f-646d405cb9f5', 'd736fca3-d206-45a5-8c9e-26879a079654' ]; var categories2 = []; gateway.Products .UpdateRelationships(productId, 'category', categories1) .then(res => console.log('test1', res)) .then(() => gateway.Products .UpdateRelationships(productId, 'category', categories2) .then(res => console.log('test2', res)) .catch(e => console.log(e)));
Loading…
no comments
sign in
to comment