Jump to content

How to get item_code of a product


Recommended Posts

Hi there,

I am making a call to the Return a Product with the product_id. Here is my request:

url = 'https://api.accounting.sage.com/v3.1/products/'+ product_id
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ' + access_token,
response = requests.request("GET", url, headers=headers)

But I am not getting any of the attributes associated with the product. All I am getting is the product_id, the description and the $path. Here is the response I get:

{'id': 'a61e87u65p98efef9', 'displayed_as': 'product description example', '$path': '/products/a61e87u65p98efef9'}

I want to be able to get the item_code of the product, but on the API reference it says that the response should include the item_code, however it isn't.

Any ideas on how I can get this attribute,

Thank you

Link to comment
Share on other sites

Hi Norman, thanks for your question.

For efficiency, the GET Request you are making returns only the three values you are seeing as default. You can specify additional attributes as a query parameter or you can return all of the product attributes by specifying the product_id in the request url or by setting the attributes query param value to all. 

Here's an example request snippet that will return the item_code in addition to the defaults. products?attributes=item_code 



Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in

Sign In Now

  • Create New...