Shotgrid: How to access api?

Hallo allerseits, wie geht’s?

In vfx or feature animation small to mid size studios depend on Autodesk Shotgrid. It is a management system on web and desktop. Below is the link for the page.

NOTE: (I’ll try to avoid jargon’s as much as possible or explain a little bit what the jargon is in a bracket. )

Autodesk Shotgrid

Shotgrid stores alot of artists and its files/data, we as developers at times need to access those data.(Assuming you are working with a show(show is a term used in companies which means – movie or tv series))

Again i am assuming you are working on a project and Shotgrid is your project management system

There are 2 ways to access api, that I am aware,

One is through the DCC environment i.e. – If you launch any application like Maya, Houdini, etc. and load a shot through SG(shotgrid) window, import SG module it, SG recognizes the context(basically shot info).

The other one is outside of DCC environment i.e. – without launching any application we need to access SG.

I’ll be emphasizing on the second one – outside of DCC.

Exact video that explains all of this, watch it till the end.

PERSONAL ACCESS TOKEN

import shotgun_api3

SERVER_PATH = 'https://<company>.shotgunstudio.com' #shotgun company link
LOGIN = 'bghuntla'
PASSWORD = 'password'

sg = shotgun_api3.Shotgun(SERVER_PATH, login=LOGIN, password=PASSWORD)
if __name__ == '__main__':
    filters = [['sg_status_list', 'is', 'act']]
    fields = ['id']
    users = sg.find('HumanUser', filters, fields)

    print('Total active Users:{}'.format(len(users)))

This is a small read to get you started with SG context

Some useful links to refer

https://developer.shotgridsoftware.com/python-api/cookbook/examples/basic_sg_instance.html

https://developer.shotgridsoftware.com/python-api/authentication.html#setting-up-shotgrid

https://developer.shotgridsoftware.com/python-api/reference.html?highlight=shotgun_api3#shotgun

Leave a comment