Would you like to hear about webinars we're
doing, new features we're adding and projects we're undertaking? Sign up
here to our pleasantly infrequent newsletter!
While this page covers a variety of examples of basic and advanced API usage, you can find a complete overview of the functions that are available
in the Moveshelf API here.
Add the following lines of code to your processing script to use the Moveshelf API:
importos,sys,jsonparent_folder=os.path.dirname(os.path.dirname(__file__))sys.path.append(parent_folder)frommoveshelf_api.apiimportMoveshelfApifrommoveshelf_apiimportutil## Setup the API
# Load config
personal_config=os.path.join(parent_folder,"mvshlf-config.json")ifnotos.path.isfile(personal_config):raiseFileNotFoundError(f"Configuration file '{personal_config}' is missing.\n""Ensure the file exists with the correct name and path.")withopen(personal_config,"r")asconfig_file:data=json.load(config_file)custom_timeout=<nSeconds># timeout (integer) for HTTP calls. Defaults to 120 if undefined
api=MoveshelfApi(api_key_file=os.path.join(parent_folder,data["apiKeyFileName"]),api_url=data["apiUrl"],timeout=custom_timeout,)
In this example we are going to use a built-in function of the Moveshelf API to retrieve the projects the current user has access to.
Add the following line of code to get a list of all the projects that are accesible by the user:
## Get available projects
projects=api.getUserProjects()
To make your life easier, we have created a list of example use cases for the Moveshelf API. Each example has a dedicated section and is explained in detail later on this page.
Refer to the following sections for example use cases for importing data: