Adding brands to product


#1

Note: Posting here as I don’t think its relevant to Marketplace

So I have created brands based on the users UID… Now I want to add the brand to a newly created product.

Is it possible to do something like this:

createProduct: (data) => {
  return axios({
    method: 'post',
    url: `${version}/products`,
    data: {
        data: {
            name: foo,
            description: foo,
            relationships: {
                id: MATCHING BRAND ID
            }
        }
    },
    headers: {
      'Content-Type': 'application/json'
    }
  })
},

#2

Hi @monkemedia

As the SDK is a wrapper for our API directly, this right now isn’t possible.

I imagine we could extend the SDK capabilities to magically transform the payload and make the relevant requests to handle this.

I’d be more inclined to push this request to our product team so it’s available via the API directly. I’ll bring it up internally :+1:

Right now you’ll want to use https://docs.moltin.com/#create-brand-relationship-s- to do this or use the JS SDK to do this…

Moltin.Products.CreateRelationships('{PRODUCT_ID}', 'brand', brandIds).then(relationships => {
    // Do something
})

#3

I will see what I can do with https://docs.moltin.com/#create-brand-relationship-s- . many thanks for the quick response


#4

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.