Shotgun API

Overview

The Shotgun API (Application Programming Interface) enables users to easily integrate their tools with Shotgun. Using the simple CRUD-based, Python API, you can quickly get your scripts integrated with Shotgun. Because the needs of every studio are very different, we provide powerful, low-level functionality and leave most of the business logic to you. 

The API follows the CRUD pattern allowing simple Create, Read, Update, and Delete actions. Each request acts on a single entity type and depending on the specific action, can define filters, columns to return, sorting information, and additional options.  In order to communicate with the Shotgun server via the API, the script must be registered with your Shotgun site and have a valid API key. You generate script keys from the Admin Scripts page :

Screen_Shot_2013-06-08_at_11.37.58_AM.png

We strongly recommend that you register your scripts separately and have individual API keys for each. This will help you to monitor each of your scripts and the actions they are performing much more accurately in the event logs.

Action Menu Items

If you set up a script that you want to easily launch from within the Shotgun interface, you can do that via Action Menu Items. These are custom menu choices that appear in the menu you get when right-clicking on an entity, and that call your script when a user clicks on them.

Action Menu Item

 

You can set up different Action Menu Items for different entities, and can restrict access to them by Project or by Permission Group. Read more technical details on how to set up Action Menu Items here.

Contribute and Collaborate

Have you made some amazing tools with Shotgun you want to share with the world? Awesome! We have an active and vibrant developer community who loves to share and collaborate with each other. So how do you get involved?

  • Join the Shotgun-Dev List
  • Post your code to GitHub (make sure your code isn't pipeline specific, is well documented, and has a README in either txt or mdk format)
  • Post a link and description to the dev list. The dev community and Shotgun developers will check it out, provide feedback, and sing your praises.

We are constantly amazed and inspired by many of the tools and integrations made by our clients. Show us what you can do!

Event Trigger Daemon

Every action performed in Shotgun (either by a user or an API script) generates an Event. The Event Daemon can monitor that event stream and then execute specific API scripts based on conditions you define. Some examples include:

  • Automatically changing downstream Task statuses based on the status of upstream Tasks.
  • Recalculate relevant cut duration fields when values change.
  • Perform file packaging and transfer operations when a Shot is set to a particular status.

And many more! The API and trigger framework are very flexible and can accommodate just about any operation you require.

Common First Projects

  1. Create a Version and link it to a Shot - allows you to automate the submission of new renders for review.
  2. Upload a thumbnail - everything on your site can have an up-to-date thumbnail without manually adding them.
  3. Integrate Shotgun with your code repository such as SVN - utilise Shotgun to project manage any software development.
  4. Link to directory creation on disk - ensure that your directories are always created with consistent structure by automating the process when Shots, Assets, etc are created in Shotgun.

Some things you can't do with the API

  • Access or alter permission rules, for security reasons (though we're considering read-only access)
  • Read or alter page settings
  • Access filter / query settings for individual pages or widgets
  • Interact with the UI
  • Set user passwords
  • Add, edit or remove Tags
  • Add, edit or remove conditional formatting rules
  • Create or edit query fields
  • Limit script access to specific projects

Links

Download the Shotgun API from GitHub

Shotgun API Wiki Documentation

Shotgun-Dev List(Public)

Shotgun Event Daemon Sample Code

How to Write Event Driven Triggers

How to Create and Manage API Scripts

Understanding the Shotgun Schema

API Performance Considerations and Best Practices

Follow

0 Comments

Please sign in to leave a comment.