// new product
var product = {
'name': {
'en': 'Foo'
},
'slug': {
'en': 'foo'
},
...
}
// update action for product name
var update = {
'version': 1,
'actions': [
{
'action': 'changeName',
'name': {
'en': 'Foo'
}
}
]
}
// this will try to create a new product with the correct body
// -> OK
sphere_client.products.save(product)
sphere_client.products.update(product)
// this will try to create a new product with a wrong body
// -> FAILS
sphere_client.products.save(update)
sphere_client.products.update(update)
// this will try to update a product with a correct body
// -> OK
sphere_client.products.byId('123-abc').save(update)
sphere_client.products.byId('123-abc').update(update)