This article covers features which are only available in the ShotHub Team Plan.
ShotHub API v1.0
Please note that scripts and access to the ShotHub API are exclusive features for users with a Team Plan.
Set up ShotHub API access.
Login to ShotHub through your browser, and import the sample projects “Hotel” (Livegrade) and “Birthday Cake” (Silverstack) or upload a library from one of the desktop applications in case you don’t have any cloud projects yet.
For security reasons, the ShotHub API can not be accessed with your regular user credentials but only through an application key associated with a script. To set up a script, open the Team Settings and go to the team scripts tab. Enter a name, e.g., “DemoScript,” into the name field and click the “Create Script” button. A dialog like this will pop up:
Store this information in a safe place, e.g., your password manager, then close the dialog. A script is “like a user,” i.e., its access is restricted to projects it has explicitly been added to and has a role within every project. Adding a script to a project is achieved through the “Add Script” dialog, which can be accessed via the button “i” next to the project name. Please add a script to at least one project before proceeding with this quick-start guide.
Create and run an example script
Now we’re all set to run our first script. For this example, we are using Python – if you do not have Python 3 installed on your machine, please install it now. No additional libraries are required; this example should work on macOS, Linux and Windows.
You can download a sample script here: sample.py (zipped Python script, 1KB)
Insert the credentials (Script ID and Script Key) you noted in the “config” settings, and then run the script from the terminal. If all goes well, you’ll see the folder hierarchy of the project(s) to which you previously added the script.
Notes for building your own scripts
While we have chosen Python for our example script, the API is language-agnostic and can be consumed in any language which offers an HTTP client and a JSON parser.
Authentication and authorization
Access to the public API requires a JWT Bearer token, delivered in the Authorization header. For obtaining the JWT token, a POST request to https://api.pomfort.com/sh/authenticate must be made using the following document structure in the body:
If the credentials are correct, the response will look as follows:
A complete reference of the available endpoints and schemas can be found at https://shothub.pomfort.com/openapi/ui.html.
A Swagger definition can be found at https://shothub.pomfort.com/openapi/v3.
Sample scripts for the ShotHub API can be found in here: https://github.com/pomfort/shothub-api-samples