REST API - How to get a list of all the "Assets" within a given project?

I need to make a list of all the “Assets” in a given project. I know the project Id is 190. I have figured out that this request will get me the project’s information:
{{host}}/api/v1/entity/:entity/:record_id?fields=*

But in the data that returns, I don’t see information for the Assets that have been created within that project.

How can I create a request that will give me all of the “Assets” within a given project?

1 Like

Hi @Michael_Rich,

Welcome to the post and thanks for posting. Sorry I don’t think I can help you on this one, but would like to share the doc below with you:

Let us know if further assistance needed. Our tech experts will be more than happy to help.

Cheers,
Ben

1 Like

Thanks @Ben_xzj. Unfortunately I’ve been through that documentation fairly thoroughly and though there’s a lot of information there, it doesn’t describe how to actually build the queries and the examples given don’t actually show examples of how to build the request either. Which means I’m still stuck.

1 Like

Hi Michael,

This post should help:

Your body might look something like:

{
  'filters': [
    [
      'project',
      'is',
      {'type':'Project', 'id':74}
    ]
  ]
}
1 Like

Thanks!

The tool I’m writing is in C#. It needs to interface with Shotgun to pull down basic data; List of projects, filtered; list of assets in that project; for a selected asset, list of tasks associated with it.

I’ve been trying to use Postman to help me construct the queries (and then spit out C# code that I can copy/modify). The problem is that for the C# code it is building the URL looking query structure (as displayed in Postman), but I have no recourse but “trial and error” to figure out what magic incantation to put in some of the text boxes (“filter” most specifically). I’ve tried many different things, and all have been wrong (and complained about by Postman). Without real-life examples to look at for what the URL looking query is supposed to look like I can’t figure it out.

Here’s an example:
Loney sent me this snippet as a way to filter based on the project ID:
/api/v1/entity/assets?filter[project.Project.id]=190&fields=*&’

I’ve tried putting in many different versions of that filter specification into the “filter” key in Postman so I can get the code. They all fail with “filter must be a hash”. I can’t figure out what formatting that means.

I see that in constructing the query it is adding a “=” between “filter” and the filter syntax. I’m guessing that might be the problem, but it’s a total guess and I have no idea how to make Postman create it correctly.

Any help would be greatly appreciated!

My only other recourse is to try to use IronPython within C# to use the Python API, but that’s proving to be rather difficult as well. And I need to get this tool up and running ASAP.

Michael Rich VES, MFA

Computer Graphics Supervisor, Lighting Supervisor
Future House Studios

2 Likes

Hi @Michael_Rich

The query string has problem. It should be filters[project.Project.id]=190. Not filters=[project.Project.id]=190

Loney

5 Likes

Thanks Loney! I thought that might be the case.

The problem is that I can’t make Postman not put that in. Do you have any experience with Postman?

2 Likes

I just figured it out. The parameters have to be declared like this in Postman. (I was trying to put the full ‘[project.Project.id]=190’ in the Value field.)

4 Likes