Skip to content

Setting Up Shotgun for API Access

kporangehat edited this page Dec 7, 2010 · 4 revisions

Before writing scripts to interact with the Shotgun API, you need to create add a script entity in Shotgun. This will automatically generate an application key which will act as the script's password. The key will look something like this: "bc29517b4928b8336e007ae48e71f082eb0e7c88". To create a new key, click the + button on the "Scripts" page in the Admin section:

Why have different application keys for different scripts?

We recommend you create a new key for each script so you can log what scripts are doing what in case one of them causes problems. This will also allow you to better see what scripts are performing what actions in the EventLog. We've found that even though you may think you'll probably never need to know, an extra 2 minutes of setup now can prevent hours of headache in the future.

Permissions

Script users are bound restrictions of their permission role, which is edited on the script record in the "Permission Role" field. The default permission role for all scripts is "API Admin User" which allows full access to create, update, and delete entities and fields, including editing the "date created" audit field and creating event log entries. If you have other permission roles for ApiUsers, you can set the default role that will be assigned when a new script is created, in the site preferences.

Event Logging

By default, events generated by scripts using an application key are logged in Shotgun's event log. You can turn this off by unchecking the "Generate Events" checkbox either in the script detail page or from the main Scripts admin page. Note that this will also prevent any email notifications from being triggered by your scripts since the email notifier relies on the event log to find events to notify for.

Why would you want to turn logging off?

It is an optimization that is not used often, but some clients have integration scripts that are pushing data into Shotgun just for reference, like publishes from their asset management system. This publish data is never changed later, so the data itself has the entire history, and the events would just clutter the event log.

Clone this wiki locally