POST to /products returns object not including the id

products

#1

Hey,

I built a backend platform for my client with which my client can create products for the custom solution. Initially the response of a POST to the /products endpoint returned an object containing a data object which contains the product. Also the id of the newly created product was included in the data object in the response. With that id I would proceed and setup some database related things.

But today my client tried to add another product resulting in an error. I checked up on the console and noticed that the POST to /products response has changed.

Now it’s an object directly containing the product, though, with far less information. Most importantly it doesn’t include the id anymore.

Was that change intended? If so how can I retrieve the id of the newly created product?

Thank you for your help!

Warm regards,
Oscar :grin:


#2

Hey Oscar :wave:t3:

I can take a look at this for you. Are you able to share the request payload and the API response?

How are you making the request? A direct API call or with one of the SDK libraries? If a library, which version are you using?

Thanks!


#3

Hey Jonathan!

I make a direct API call to create the product.

That is one example request:

{  
   "type": "product",
   "name": "Tauleine \"Old Is The New New\"",
   "slug": "tauleine_old-is-the-new-new relation",
   "sku": "tauleine_OldIsTheNewNew_{type}",
   "description": "Demo Decription",
   "manage_stock": false,
   "price": [  
       {  
          "amount": 3900,
          "currency": "EUR",
          "includes_tax": true
       }
   ],
   "status": "live",
   "commodity_type": "physical"
}

Thank you for your help! :+1:t2:

EDIT:

The old behavior was that Moltin returned a very similar response to that when GETting /products/:productID.


#4

I’ve been unable to replicate this issue using Insomnia :thinking:

Are you using a particular HTTP request library? Can you share your code that fires the request?


#5

I’m deeply sorry…

I haven’t been working on our backend for a month or so. I found the issue which is not related to Moltin in any way.

Sorry for the inconvenience.

Have a great weekend, Jonathan! :+1:t2:


#6

No problem! have a good one :upside_down_face:


#7

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