Hi There,
I am totally new to Shotgun, and also (marginally) new to Python. I've been looking at using the API to return a list of all projects available, but I've not quite gotten the code right. Can anyone suggest a way to do this?
Thanks.
Hi There,
I am totally new to Shotgun, and also (marginally) new to Python. I've been looking at using the API to return a list of all projects available, but I've not quite gotten the code right. Can anyone suggest a way to do this?
Thanks.
@Wallace
Welcome! If you haven't found this already, here's some info for getting started:
1) Get setup with the API and make sure your script is communicating with your site: https://github.com/shotgunsoftware/python-api/wiki/Reference%3A-Methods#shotgun
2) Read up on the find() method for finding more than one thing: https://github.com/shotgunsoftware/python-api/wiki/Reference%3A-Methods#find
3) Write some code to grab all the Project names on your site. Here's an example:
all_projects = sg.find('Project',[],fields) #returns all Projects in the system
4) Build a list of all of your Projects using some Python. For example:
for project in all_projects:
project_list.append(project['name')
5) Do what you list with your 'project_list'!
Hope this gets you started! Feel free to shoot any other tech questions to support@shotgunsoftware.com and we'll get back to you as soon as we can!
Thanks. This was good. I eventually figured it out. Just took me a while to wrap my head around the Python ideas. I am doing listings easy now. Now, how do I get "person" entities to list? It seems to give me an error saying that a "person" is not a recognized "type". Not quite sure what to think of that, since it's in the fields listing. What am I missing?
Hey Wallace,
The database name for the Person entity is HumanUser. You can find the database name of each entity type by going to Site Preferences > Entities where you'll see both the human readable name and its database name. Let me know if that works for you!