Filtering by "fields" with V4

,

Hi, I would like to know how I can retrieve or filter the “keywords” from the “fields” tab (that I can see in the web UI).

I found “include=metatadata”, but that only covers clip length, codec, etc. But it doesn’t allow me to filter by keywords.

Attached is a screenshot of the Web-UI with the opened drawer on the right side, when a clip is selected.

Am I blind or is this more of a “feature request”, which is what I’m trying to explain?

@jezekjancom Which keywords are you looking for specifically? If I am using the GET {{BASE_URL}}/v4/accounts/:account_id/files/:file_id?include=metadata endpoint in postman (with api-version:alpha in the header) I can get all of the fields in your screenthot returned to me:

it would be under the file_attributes array, which might be a few more layers deep

{"data":{"metadata":{"file_attributes":[{**here**}]}}}

Hi @CharlieAnderson , thank you for answering.

TL/DR: Goal is to get a “filtered” list of assets for “approved” and specific (or custom) keywords

The most important “meta”-fields at least for me are:

  • keywords
  • status (I mean the “approved, in progress, needs review” one)
  • custom fields

I only found SOME of these metadata when directly requesting the /metadata endpoint for an specific asset:

When I request {{BASE_URL}}/v4/accounts/:account_id/files/:file_id/metadata then I get (some of the things) I need:

{
    "data": {
        "asset_id": "93131618-de52-4b8c-83fe-eab1b7a4ff10",
        "custom_fields": [],
        "essentials": [
            {
                "value": [
                    {
                        "id": "c35c7325-b800-4ed5-8987-49aa7979b7d4",
                        "display_name": "Approved"
                    }
                ],
                "field_type": "select",
                "field_definition_id": "c68dca50-8c97-4cf3-bcc0-1a0a0187c98c",
                "field_definition_name": "Status",
                "field_options": [
                    {
                        "id": "fab52ac1-9acd-4e20-aebe-cad50b9d97e0",
                        "display_name": "Needs Review"
                    },
                    {
                        "id": "4802acd6-984f-446b-9206-3742d6a9d510",
                        "display_name": "In Progress"
                    },
                    {
                        "id": "c35c7325-b800-4ed5-8987-49aa7979b7d4",
                        "display_name": "Approved"
                    }
                ]
            }
        ],

The include=metadata only returns "basic infos for the video file itself like filesize, bitrate, codec, which is not in my interest:
{{BASE_URL}}/v4/accounts/:account_id/folders/:folder_id/children?include=metadata

I need criterias like “approved” status (the only “status” field in the list view is the “transcoded” one… ).

Sure I can first list all assets, then request each of the asset_ids against the /metadata endpoint, and then filter them locally. But this is an overkill for the API

I hope I was able to describe my problem

thank you in advance

{{BASE_URL}}/v4/accounts/:account_id/files/:file_id/metadata should return your keywords in that response, I can confirm that here:

When investigating, I noticed that the essentials array can return empty if there’s been nothing associated that array yet, which I’ve raised to the dev team as a bug (it’s fine if you’re just reading, however if you want to update a status from the get go you cannot as you need the status id to do so).

So it seems like unless an asset has these fields applied already to the asset via the web app, they will not be returned in the response.

I can confirm that even though a custom field has been associated with an asset, it will not be returned until it is enabled/activated in some way.


I’ve raised these issues with the dev team so thanks for helping bring them to our attention!

1 Like

Thank you @CharlieAnderson for raising this to the devs :smiling_face_with_sunglasses:

A “feature request” and maybe “common use case” could look like:

  • In order to filter assets of a specific folder by custom criteria
  • the user should know possible custom possibilites
  • by requesting /metadata
  • a list of all possible custom (and standard) “keyword”-tags of that folder should be returned as json object (similar to requesting a single /metadata of an asset
  • the user should be able to filter/search assets by given criteria (eg: /children?filter={field_definition_id=[xxx,yyy],status=approved} etc…

I tried to figure out, how the Web-UI is getting these data shown here:

It seems that this goes to a graphql request, but I can’t do that against the regular API.

It would be nice, to have access to all the custom fields (and metafields) to prefill forms without overheating the API. like so:


{
    "data": {
        "custom_fields": [
            {
                "value": [
                    {
                        "id": "6404e3d2-7ba7-4d06-8209-5a16ce1eee2a",
                        "display_name": "TikTok"
                    },
                    {
                        "id": "2559bff7-0011-486d-8108-b3043935a2c5",
                        "display_name": "Facebook"
                    },
                    {
                        "id": "bf8fbfbd-bb21-41d4-9da9-29f1e8a0747a",
                        "display_name": "Instagram"
                    }
                ],
                "field_type": "select_multi",
                "field_definition_id": "3ce109fc-40c5-4ef2-895f-44275ec3ee26",
                "field_definition_name": "Social Media Target",
                "field_options": [
                    {
                        "id": "6404e3d2-7ba7-4d06-8209-5a16ce1eee2a",
                        "display_name": "TikTok"
                    },
                    {
                        "id": "bf8fbfbd-bb21-41d4-9da9-29f1e8a0747a",
                        "display_name": "Instagram"
                    },
                    {
                        "id": "2559bff7-0011-486d-8108-b3043935a2c5",
                        "display_name": "Facebook"
                    },
                    {
                        "id": "4b6f18b8-cdde-4834-a761-7ac613b70087",
                        "display_name": "Twitter"
                    }
                ]
            }
        ],
        "essentials": [
            {
                "value": 1,
                "field_type": "rating",
                "field_definition_id": "4109f4b9-aee7-47f8-8daa-bdc8b2283bc3",
                "field_definition_name": "Rating"
            },
            {
                "value": [
                    {
                        "id": "0ac56323-1569-496a-93ab-e83e20390106",
                        "display_name": "supershot"
                    }
                ],
                "field_type": "select_multi",
                "field_definition_id": "6c6cd6a4-ba14-4d06-bdee-4f4ac8bbe524",
                "field_definition_name": "Keywords",
                "field_options": [
                    {
                        "id": "0ac56323-1569-496a-93ab-e83e20390106",
                        "display_name": "supershot"
                    },
                    {
                        "id": "d40ea7f0-60e5-44ca-a199-8523a5c90457",
                        "display_name": "demo"
                    },
                    {
                        "id": "4c31f6b0-bf40-44ac-abf8-bc2527dabf3f",
                        "display_name": "closeup"
                    }
                ]
            }
        ],

Thank you for reading.. :wink:

have anice day

Ah yes, I see what you are describing. This has not been developed yet. I will add it to our feature requests!

1 Like

Cool :smiling_face_with_sunglasses: I hope I am not the only one with such wishes :slight_smile: