Media - Search
  • 22 Dec 2023
  • 9 Minutes to read
  • Dark
    Light

Media - Search

  • Dark
    Light

Article summary

Search Media

Uploaded media objects can be searched using the file's md5, filename, or external_media_id

The following query parameters are supported:

Argument

Example

Description

filename
string

"my_image.jpg"

The file name of the uploaded media.

external_media_id
string

"000060e3121c7305"

A unique ID for this media from its external data source.
 
 E.g., the ImageID field from the OpenImages dataset.

md5
string

c7299866d9a68aa6735dd10

md5 hash of the media file.

GET /1/media/all/search
Host: https://api.cogniac.io

Example: Search for a media

curl -X GET https://api.cogniac.io/1/media/all/search \
-H "Authorization: Bearer abcdefg.hijklmnop.qrstuvwxyz" \
-H "Content-Type: application/json" \
-d '{
"filename":"Cat.jpg"
}' | json_pp
import requests
import json

url_prefix = 'https://api.cogniac.io'
api_version = "1"
media_id = 'QBCYGH2LACG4IDFQLRXJVIE1BWWH'
token = ''  # add your token here
headers = {'Authorization': f'Bearer {token}'}  
media_data = {
  "filename": "001.png"
   }

url = f'{url_prefix}/{api_version}/media/all/search'
response = requests.get(url,json=media_data, headers=headers)

if response.status_code == 200:
    formatted_json = json.dumps(response.json(), indent=2)
    print(formatted_json)
else:
    print(f"Error: {response.status_code}")
    print(response.content)
{
  "data": [
    {
      "original_url": null,
      "set_assignment": "validation",
      "num_frames": null,
      "frame": null,
      "image_height": 2050,
      "video": false,
      "frame_durations": [],
      "bits_per_pixel": 8,
      "duration": null,
      "size": 5020437.0,
      "video_context": null,
      "network_camera_id": null,
      "resize_urls": {
        "1334": "https://api.cogniac.io/1/media/download/TNYALYUBXDVPKHJFLPY4AXHGE2A8/TNYALYUBXDVPKHJFLPY4AXHGE2A8_max_1334",
        "454": "https://api.cogniac.io/1/media/download/TNYALYUBXDVPKHJFLPY4AXHGE2A8/TNYALYUBXDVPKHJFLPY4AXHGE2A8_max_454"
      },
      "author": null,
      "image_width": 2432,
      "filename": "001.png",
      "original_landing_url": null,
      "fps": null,
      "uploaded_by_user": "test@cogniac.co",
      "media_timestamp": 1688486055.756034,
      "media_url": "https://api.cogniac.io/1/media/download/TNYALYUBXDVPKHJFLPY4AXHGE2A8/TNYALYUBXDVPKHJFLPY4AXHGE2A8",
      "status": "success",
      "media_id": "TNYALYUBXDVPKHJFLPY4AXHGE2A8",
      "external_media_id": null,
      "time_base": null,
      "trigger_id": null,
      "source_url": null,
      "author_profile_url": null,
      "sequence_ix": null,
      "media_src": "command_line",
      "parent_media_id": null,
      "domain_unit": "d28292ba41d0df66ddc29957feb6d1e1",
      "md5": "d28292ba41d0df66ddc29957feb6d1e1",
      "parent_media_ids": [],
      "meta_tags": [
        "test@cogniac.co",
        "mobile",
        "iPhone 6+",
        "9.2",
        "v2.1"
      ],
      "license": null,
      "tenant_id": "abcdefghijk",
      "created_at": 1688486055.756034,
      "title": null,
      "preview_url": null,
      "num_channels": 3,
      "media_format": "PNG",
      "frame_preview_map": {}
    },
    {
      "original_url": null,
      "set_assignment": "training",
      "num_frames": null,
      "frame": null,
      "image_height": 2050,
      "video": false,
      "frame_durations": [],
      "bits_per_pixel": 8,
      "duration": null,
      "size": 5020437.0,
      "video_context": null,
      "network_camera_id": null,
      "resize_urls": {
        "1334": "https://api.cogniac.io/1/media/download/ID6EGCGCF2FY3KHLOORQCEZ5X8PH/ID6EGCGCF2FY3KHLOORQCEZ5X8PH_max_1334",
        "454": "https://api.cogniac.io/1/media/download/ID6EGCGCF2FY3KHLOORQCEZ5X8PH/ID6EGCGCF2FY3KHLOORQCEZ5X8PH_max_454"
      },
      "author": null,
      "image_width": 2432,
      "filename": "001.png",
      "original_landing_url": null,
      "fps": null,
      "uploaded_by_user": "test@cogniac.co",
      "media_timestamp": 1683736933.2658236,
      "media_url": "https://api.cogniac.io/1/media/download/ID6EGCGCF2FY3KHLOORQCEZ5X8PH/ID6EGCGCF2FY3KHLOORQCEZ5X8PH",
      "status": "success",
      "media_id": "ID6EGCGCF2FY3KHLOORQCEZ5X8PH",
      "external_media_id": null,
      "time_base": null,
      "trigger_id": null,
      "source_url": null,
      "author_profile_url": null,
      "sequence_ix": null,
      "media_src": null,
      "parent_media_id": null,
      "domain_unit": "d28292ba41d0df66ddc29957feb6d1e1",
      "md5": "d28292ba41d0df66ddc29957feb6d1e1",
      "parent_media_ids": [],
      "meta_tags": null,
      "license": null,
      "tenant_id": "abcdefghijk",
      "created_at": 1683922254.93599,
      "title": null,
      "preview_url": null,
      "num_channels": 3,
      "media_format": "PNG",
      "frame_preview_map": {}
    },
    {
      "original_url": null,
      "set_assignment": "training",
      "num_frames": null,
      "frame": null,
      "image_height": 2050,
      "video": false,
      "frame_durations": [],
      "bits_per_pixel": 8,
      "duration": null,
      "size": 5020437.0,
      "video_context": null,
      "network_camera_id": null,
      "resize_urls": {
        "1334": "https://api.cogniac.io/1/media/download/BXE49QC9UAFNPDIVQHG8H2S3EAJP/BXE49QC9UAFNPDIVQHG8H2S3EAJP_max_1334",
        "454": "https://api.cogniac.io/1/media/download/BXE49QC9UAFNPDIVQHG8H2S3EAJP/BXE49QC9UAFNPDIVQHG8H2S3EAJP_max_454"
      },
      "author": null,
      "image_width": 2432,
      "filename": "001.png",
      "original_landing_url": null,
      "fps": null,
      "uploaded_by_user": "test@cogniac.co",
      "media_timestamp": 1683736933.2658236,
      "media_url": "https://api.cogniac.io/1/media/download/BXE49QC9UAFNPDIVQHG8H2S3EAJP/BXE49QC9UAFNPDIVQHG8H2S3EAJP",
      "status": "success",
      "media_id": "BXE49QC9UAFNPDIVQHG8H2S3EAJP",
      "external_media_id": null,
      "time_base": null,
      "trigger_id": null,
      "source_url": null,
      "author_profile_url": null,
      "sequence_ix": null,
      "media_src": null,
      "parent_media_id": null,
      "domain_unit": "d28292ba41d0df66ddc29957feb6d1e1",
      "md5": "d28292ba41d0df66ddc29957feb6d1e1",
      "parent_media_ids": [],
      "meta_tags": null,
      "license": null,
      "tenant_id": "abcdefghijk",
      "created_at": 1683921875.766705,
      "title": null,
      "preview_url": null,
      "num_channels": 3,
      "media_format": "PNG",
      "frame_preview_map": {}
    },
    {
      "original_url": null,
      "set_assignment": "training",
      "num_frames": null,
      "frame": null,
      "image_height": 2050,
      "video": false,
      "frame_durations": [],
      "bits_per_pixel": 8,
      "duration": null,
      "size": 5020437.0,
      "video_context": null,
      "network_camera_id": null,
      "resize_urls": {
        "1334": "https://api.cogniac.io/1/media/download/L1VLIR8AIKKPBCRJSHXOMS4HYEH2/L1VLIR8AIKKPBCRJSHXOMS4HYEH2_max_1334",
        "454": "https://api.cogniac.io/1/media/download/L1VLIR8AIKKPBCRJSHXOMS4HYEH2/L1VLIR8AIKKPBCRJSHXOMS4HYEH2_max_454"
      },
      "author": null,
      "image_width": 2432,
      "filename": "001.png",
      "original_landing_url": null,
      "fps": null,
      "uploaded_by_user": "test@cogniac.co",
      "media_timestamp": 1683736933.2658236,
      "media_url": "https://api.cogniac.io/1/media/download/L1VLIR8AIKKPBCRJSHXOMS4HYEH2/L1VLIR8AIKKPBCRJSHXOMS4HYEH2",
      "status": "success",
      "media_id": "L1VLIR8AIKKPBCRJSHXOMS4HYEH2",
      "external_media_id": null,
      "time_base": null,
      "trigger_id": null,
      "source_url": null,
      "author_profile_url": null,
      "sequence_ix": null,
      "media_src": null,
      "parent_media_id": null,
      "domain_unit": "d28292ba41d0df66ddc29957feb6d1e1",
      "md5": "d28292ba41d0df66ddc29957feb6d1e1",
      "parent_media_ids": [],
      "meta_tags": null,
      "license": null,
      "tenant_id": "abcdefghijk",
      "created_at": 1683855526.500383,
      "title": null,
      "preview_url": null,
      "num_channels": 3,
      "media_format": "PNG",
      "frame_preview_map": {}
    },
    {
      "original_url": null,
      "set_assignment": "training",
      "num_frames": null,
      "frame": null,
      "image_height": 2050,
      "video": false,
      "frame_durations": [],
      "bits_per_pixel": 8,
      "duration": null,
      "size": 5020437.0,
      "video_context": null,
      "network_camera_id": null,
      "resize_urls": {
        "1334": "https://api.cogniac.io/1/media/download/KA0FUHHO9EE2BI1Q9DMQH4ANF9RV/KA0FUHHO9EE2BI1Q9DMQH4ANF9RV_max_1334",
        "454": "https://api.cogniac.io/1/media/download/KA0FUHHO9EE2BI1Q9DMQH4ANF9RV/KA0FUHHO9EE2BI1Q9DMQH4ANF9RV_max_454"
      },
      "author": null,
      "image_width": 2432,
      "filename": "001.png",
      "original_landing_url": null,
      "fps": null,
      "uploaded_by_user": "test@cogniac.co",
      "media_timestamp": 1683736933.2658236,
      "media_url": "https://api.cogniac.io/1/media/download/KA0FUHHO9EE2BI1Q9DMQH4ANF9RV/KA0FUHHO9EE2BI1Q9DMQH4ANF9RV",
      "status": "success",
      "media_id": "KA0FUHHO9EE2BI1Q9DMQH4ANF9RV",
      "external_media_id": null,
      "time_base": null,
      "trigger_id": null,
      "source_url": null,
      "author_profile_url": null,
      "sequence_ix": null,
      "media_src": null,
      "parent_media_id": null,
      "domain_unit": "d28292ba41d0df66ddc29957feb6d1e1",
      "md5": "d28292ba41d0df66ddc29957feb6d1e1",
      "parent_media_ids": [],
      "meta_tags": null,
      "license": null,
      "tenant_id": "abcdefghijk",
      "created_at": 1683922185.885912,
      "title": null,
      "preview_url": null,
      "num_channels": 3,
      "media_format": "PNG",
      "frame_preview_map": {}
    },
    {
      "original_url": null,
      "set_assignment": "training",
      "num_frames": null,
      "frame": null,
      "image_height": 2050,
      "video": false,
      "frame_durations": [],
      "bits_per_pixel": 8,
      "duration": null,
      "size": 5020437.0,
      "video_context": null,
      "network_camera_id": null,
      "resize_urls": {
        "1334": "https://api.cogniac.io/1/media/download/7TYUC6PCBXLYNN4GHSPX3BNYNJAJ/7TYUC6PCBXLYNN4GHSPX3BNYNJAJ_max_1334",
        "454": "https://api.cogniac.io/1/media/download/7TYUC6PCBXLYNN4GHSPX3BNYNJAJ/7TYUC6PCBXLYNN4GHSPX3BNYNJAJ_max_454"
      },
      "author": null,
      "image_width": 2432,
      "filename": "001.png",
      "original_landing_url": null,
      "fps": null,
      "uploaded_by_user": "test@cogniac.co",
      "media_timestamp": 1683736933.2658236,
      "media_url": "https://api.cogniac.io/1/media/download/7TYUC6PCBXLYNN4GHSPX3BNYNJAJ/7TYUC6PCBXLYNN4GHSPX3BNYNJAJ",
      "status": "success",
      "media_id": "7TYUC6PCBXLYNN4GHSPX3BNYNJAJ",
      "external_media_id": null,
      "time_base": null,
      "trigger_id": null,
      "source_url": null,
      "author_profile_url": null,
      "sequence_ix": null,
      "media_src": null,
      "parent_media_id": null,
      "domain_unit": "d28292ba41d0df66ddc29957feb6d1e1",
      "md5": "d28292ba41d0df66ddc29957feb6d1e1",
      "parent_media_ids": [],
      "meta_tags": null,
      "license": null,
      "tenant_id": "abcdefghijk",
      "created_at": 1683921768.963486,
      "title": null,
      "preview_url": null,
      "num_channels": 3,
      "media_format": "PNG",
      "frame_preview_map": {}
    },
    {
      "original_url": null,
      "set_assignment": "training",
      "num_frames": null,
      "frame": null,
      "image_height": 2050,
      "video": false,
      "frame_durations": [],
      "bits_per_pixel": 8,
      "duration": null,
      "size": 5020437.0,
      "video_context": null,
      "network_camera_id": null,
      "resize_urls": {
        "1334": "https://api.cogniac.io/1/media/download/C4WHVPA215OJFQH78SXOYZDVFW4Z/C4WHVPA215OJFQH78SXOYZDVFW4Z_max_1334",
        "454": "https://api.cogniac.io/1/media/download/C4WHVPA215OJFQH78SXOYZDVFW4Z/C4WHVPA215OJFQH78SXOYZDVFW4Z_max_454"
      },
      "author": null,
      "image_width": 2432,
      "filename": "001.png",
      "original_landing_url": null,
      "fps": null,
      "uploaded_by_user": "test@cogniac.co",
      "media_timestamp": 1683736933.2658236,
      "media_url": "https://api.cogniac.io/1/media/download/C4WHVPA215OJFQH78SXOYZDVFW4Z/C4WHVPA215OJFQH78SXOYZDVFW4Z",
      "status": "success",
      "media_id": "C4WHVPA215OJFQH78SXOYZDVFW4Z",
      "external_media_id": null,
      "time_base": null,
      "trigger_id": null,
      "source_url": null,
      "author_profile_url": null,
      "sequence_ix": null,
      "media_src": null,
      "parent_media_id": null,
      "domain_unit": "d28292ba41d0df66ddc29957feb6d1e1",
      "md5": "d28292ba41d0df66ddc29957feb6d1e1",
      "parent_media_ids": [],
      "meta_tags": null,
      "license": null,
      "tenant_id": "abcdefghijk",
      "created_at": 1684194605.179325,
      "title": null,
      "preview_url": null,
      "num_channels": 3,
      "media_format": "PNG",
      "frame_preview_map": {}
    },
    {
      "original_url": null,
      "set_assignment": "training",
      "num_frames": null,
      "frame": null,
      "image_height": 2050,
      "video": false,
      "frame_durations": [],
      "bits_per_pixel": 8,
      "duration": null,
      "size": 5020437.0,
      "video_context": null,
      "network_camera_id": null,
      "resize_urls": {
        "1334": "https://api.cogniac.io/1/media/download/FIOU1WTJE2OABI3F2DYUWIK4UHTU/FIOU1WTJE2OABI3F2DYUWIK4UHTU_max_1334",
        "454": "https://api.cogniac.io/1/media/download/FIOU1WTJE2OABI3F2DYUWIK4UHTU/FIOU1WTJE2OABI3F2DYUWIK4UHTU_max_454"
      },
      "author": null,
      "image_width": 2432,
      "filename": "001.png",
      "original_landing_url": null,
      "fps": null,
      "uploaded_by_user": "test@cogniac.co",
      "media_timestamp": 1683736933.2658236,
      "media_url": "https://api.cogniac.io/1/media/download/FIOU1WTJE2OABI3F2DYUWIK4UHTU/FIOU1WTJE2OABI3F2DYUWIK4UHTU",
      "status": "success",
      "media_id": "FIOU1WTJE2OABI3F2DYUWIK4UHTU",
      "external_media_id": null,
      "time_base": null,
      "trigger_id": null,
      "source_url": null,
      "author_profile_url": null,
      "sequence_ix": null,
      "media_src": null,
      "parent_media_id": null,
      "domain_unit": "d28292ba41d0df66ddc29957feb6d1e1",
      "md5": "d28292ba41d0df66ddc29957feb6d1e1",
      "parent_media_ids": [],
      "meta_tags": null,
      "license": null,
      "tenant_id": "abcdefghijk",
      "created_at": 1683904794.028371,
      "title": null,
      "preview_url": null,
      "num_channels": 3,
      "media_format": "PNG",
      "frame_preview_map": {}
    },
    {
      "original_url": null,
      "set_assignment": "training",
      "num_frames": null,
      "frame": null,
      "image_height": 2050,
      "video": false,
      "frame_durations": [],
      "bits_per_pixel": 8,
      "duration": null,
      "size": 5020437.0,
      "video_context": null,
      "network_camera_id": null,
      "resize_urls": {
        "1334": "https://api.cogniac.io/1/media/download/O5099YSO56AP2FPPJDW8V7H4BOVA/O5099YSO56AP2FPPJDW8V7H4BOVA_max_1334",
        "454": "https://api.cogniac.io/1/media/download/O5099YSO56AP2FPPJDW8V7H4BOVA/O5099YSO56AP2FPPJDW8V7H4BOVA_max_454"
      },
      "author": null,
      "image_width": 2432,
      "filename": "001.png",
      "original_landing_url": null,
      "fps": null,
      "uploaded_by_user": "test@cogniac.co",
      "media_timestamp": 1683736933.2658236,
      "media_url": "https://api.cogniac.io/1/media/download/O5099YSO56AP2FPPJDW8V7H4BOVA/O5099YSO56AP2FPPJDW8V7H4BOVA",
      "status": "success",
      "media_id": "O5099YSO56AP2FPPJDW8V7H4BOVA",
      "external_media_id": null,
      "time_base": null,
      "trigger_id": null,
      "source_url": null,
      "author_profile_url": null,
      "sequence_ix": null,
      "media_src": null,
      "parent_media_id": null,
      "domain_unit": "d28292ba41d0df66ddc29957feb6d1e1",
      "md5": "d28292ba41d0df66ddc29957feb6d1e1",
      "parent_media_ids": [],
      "meta_tags": null,
      "license": null,
      "tenant_id": "abcdefghijk",
      "created_at": 1683921984.190839,
      "title": null,
      "preview_url": null,
      "num_channels": 3,
      "media_format": "PNG",
      "frame_preview_map": {}
    }
  ],
  "last_key": null
}


Was this article helpful?

What's Next