Hoping someone can please be of help. We are building a basic API to set inventory levels on Shopify. We are new at this so please mind our code, if it’s wrong we would love some advice.
We are using the ShopifyApi module for python.
When we run the below code we get an error code “urllib.error.HTTPError: HTTP Error 404: Not Found”
We can confirm all of our credentials are correct as we can export from Shopify but not set inventory levels. The ‘location_id’ and ‘inventory_item_id’ are all correct as per an export we ran also.
Our admin api has inventory permissions to read and write aswell.
import shopify
import os
from dotenv import load_dotenv
load_dotenv()
token = os.getenv('TOKEN')
merchant = os.getenv('MERCHANT')
session = shopify.Session(merchant, '2023-04', token)
shopify.ShopifyResource.activate_session(session)
def set_inventory_level():
shopify.InventoryLevel.set(78463762749, 44730407518525, 555, disconnect_if_necessary=True)
set_inventory_level()