Getting product/variant cost from API using Python

New Member
2 0 0

I have been working on a private app, and have it working pulling most all of the data I need using python GET request.

The problem I'm having now, is pulling product cost. I can parse the GID, product ID and variant ID from lineitems.

 

But I can't seem to get the API to provide any inventory or cost response. 

 

I'm using 

GET /admin/api/2020-01/inventory_items.json?

and also:

GET /admin/api/2020-01/inventory_items/#{inventory_item_id}.json

 

I have tried everything on the page,  https://shopify.dev/docs/admin-api/rest/reference/inventory/inventoryitem#show-2020-01.

 

I usually get the response:

{
"errors": "Not Found"
}

 

or:

{
"inventory_items": []
}

 

 

I have verified that my app has permissions, and I verified the product ID and variant ID several times but can't seem to get anything back. 

 

I have the shopify python API installed locally and have also used it to get some product info but can't format inventory correctly to get that to work either. 

 

Any ideas?

 

I'm just wanting  to pull down the COGS so I can calculate net profit.

 

0 Likes
Highlighted
New Member
2 0 0

using the python library, I tried this also:

 

shopify.InventoryItem.find()

and tried the GID, Variant, ProductID and couldn't get that to work either.
0 Likes