Salesforce

Sample requests and responses

« Go Back
Information
Sample requests and responses
000004332
Public
Product Selection
aiWare - aiWare
Article Details

To test using the Veritone Search API, we've put together a collection of example queries and responses. These sample requests are structured for use in our GraphQL interface, but we’ve also included the basic curl structure for your reference below.

Requests must be authenticated with an API token. Pass the token in your request using the Authorization header with a value Bearer. If you’re using a raw HTTP client, the query body contents must be sent in a string (not an object) with all quotes escaped.

[Note] The examples do not use client information and are not language specific. For fields that require account-specific data (such as a Recording ID), replace the value with your own.

Basic curl structure

curl -X POST \
  https://api.veritone.com/v3/graphql \
  -H 'authorization: Bearer 2079b07c-1a6f-4c2e-b534-a1aaa7f7fe42' \
  -H 'content-type: application/json' \
  -d '{
    "query": " query { searchMedia(search: { offset: 0, limit: 2, index: [\"global\"], query: { operator: \"term\", field: \"programName\", value: \"basketball\"   }}) { jsondata } }"
}'

The sample is a media search of both indexes where NBA was recognized as text and the words "Kobe Bryant" and “basketball” or “Lakers” was found in a transcript. This request also includes a select statement that limits the search to transcripts and Veritone files.

query{
  searchMedia(search:{
    offset: 0
    limit: 1
    index: ["mine"]
    operator: "query_object"
    query:{
        operator: "or"
        conditions: [{
            operator: "range"
            field: "absoluteStartTimeMs"
            lt: 1485417954000
          },
          {
            operator: "term"
            field: "text-recognition.series.ocrtext"
            value: "nba"
          },
          {
            operator: "query_string"
            field: "transcript.transcript"
            value: "\"kobe bryant\" AND (basketball OR lakers)"
          }
         ]
      }
}) {
    jsondata
  }
}
{
  "data": {
    "searchMedia": {
      "jsondata": {
        "results": [
          {
            "recording": {
              "recordingId": "16322767",
              "fileLocation": "https://inspirent.s3.amazonaws.com/assets/16322767/b8936c78-2186-72e5-93af-5c5aa13dd982.mp4?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAI7L6G7PCOOOLA7MQ%2F20171215%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20171215T155327Z&X-Amz-Expires=604800&X-Amz-Signature=49a0bec006693905a66cfb0972167170b14947e05c66dbcf98ed705f31726a03&X-Amz-SignedHeaders=host",
              "fileType": "video/mp4",
              "programId": "-1",
              "programName": "Private Media",
              "mediaSourceId": "-1",
              "mediaSourceTypeId": "5",
              "tags": [
                {
                  "value": "TEDx",
                  "displayName": "TEDx"
                },
                {
                  "value": "Tolo West",
                  "displayName": "Tolo West"
                }
              ],
              "sliceTime": 1484780795,
              "mediaStartTime": 1484780045,
              "aibDuration": 810,
              "isOwn": true,
              "hitStartTime": 1484780795,
              "hitEndTime": 1484780855
            },
            "startDateTime": 1484780795,
            "stopDateTime": 1484780855,
            "hits": []
          }
        ],
        "totalResults": 728274,
        "limit": 1,
        "from": 0,
        "to": 0,
        "searchToken": "171a1b10-e9c0-11e7-bae7-61a10650068b",
        "timestamp": 1513353207
      }
    }
  }
}

Sample request 2: exists query

The example below is a media search against the private index for records with a filename.

query{
  searchMedia(search:{
    offset: 0
    limit: 1
    index: ["mine"]
    query:{
        operator: "exists"
        name: "veritone-file.filename"
    }
  }) {
    jsondata
  }
}

Sample response 2: exists query

{
  "data": {
    "searchMedia": {
      "jsondata": {
        "results": [
          {
            "recording": {
              "recordingId": "43033727",
              "fileLocation": "https://inspirent.s3.amazonaws.com/assets/43033727/ea9d9845-775b-48cd-aada-16fa56894ba0.mp4?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAI7L6G7PCOOOLA7MQ%2F20171215%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20171215T181255Z&X-Amz-Expires=604800&X-Amz-Signature=2fd918d5ac20979bd27d365bfa455904cf1726307fddbd362a28a8bd9a0a81a8&X-Amz-SignedHeaders=host",
              "fileType": "video/mp4",
              "programId": "-1",
              "programName": "Weekly Talkshow",
              "programLiveImage": "https://inspirent.s3.amazonaws.com/assets/43033727/fe693b30-18ae-47c7-984f-530eab61d7.jpeg",
              "mediaSourceId": "-1",
              "mediaSourceTypeId": "5",
              "sliceTime": 1512682022,
              "mediaStartTime": 1512681992,
              "aibDuration": 90,
              "isOwn": true,
              "hitStartTime": 1512682022,
              "hitEndTime": 1512682082
            },
            "startDateTime": 1512682022,
            "stopDateTime": 1512682082,
            "hits": [
              {
                "veritone-file": {
                  "filename": "Veritone_v06.mp4",
                  "mimetype": "video/mp4",
                  "size": 162533502
                }
              }
            ]
          }
        ],
        "totalResults": 733275,
        "limit": 1,
        "from": 0,
        "to": 0,
        "searchToken": "930f0960-e1c3-11e7-9e94-eba5f6b5faf7",
        "timestamp": 1513361576
      }
    }
  }
}

Sample request 3: "or" query with negation

The example below is a media search of the public index for Coke or Pepsi logos but not Redbull.

query{
  searchMedia(search:{
    offset: 0
    limit: 1
    index: ["global"]
    query:{
        operator: "or"
        conditions: [{
            operator: "term"
            field: "logo-recognition.series.found"
            value: "Coke"
            },
            {
            operator: "term"
            field: "logo-recognition.series.found"
            value: "Pepsi"
            },
            {
            operator: "term"
            field: "logo-recognition.series.found"
            value: "Redbull"
            not: true
        }]
    }
  }) {
    jsondata
  }
}

Sample response 3: "or" query with negation

{
  "data": {
    "searchMedia": {
      "jsondata": {
        "results": [
          {
            "recording": {
              "recordingId": "43842334",
              "fileLocation": "https://inspirent.s3.amazonaws.com/tv-recordings/vv-stream/39898/2017/12/14/processed/39898_20171214_0720_263a786f-3d59-4572-9752-984ded917573.mp4?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAI7L6G7PCOOOLA7MQ%2F20171214%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20171214T211125Z&X-Amz-Expires=604800&X-Amz-Signature=af6b9acc5b113949fb3d01ec3464c14e10449bd0bd51d250bdd906504588caa2&X-Amz-SignedHeaders=host",
              "fileType": "video/mp4",
                "programId": "27405",
              "programName": "Prime Time",
              "programImage": "https://s3.amazonaws.com/prod-veritone-ugc/programs/27405/3tWiUgZNS42vWB55dED3_GRftjRV6_400x400.jpg",
              "mediaSourceId": "37802",
              "mediaSourceTypeId": "2",
              "isPublic": true,
              "sliceTime": 1513236060,
              "mediaStartTime": 1513236000,
              "aibDuration": 120,
              "isOwn": false,
              "hitStartTime": 1513236064,
              "hitEndTime": 1513236067
            },
            "startDateTime": 1513236060,
            "stopDateTime": 1513236120,
            "hits": [
              {
                "logo-recognition": {
                  "source": "bf50297a-55f1-5a27-17a1-d213ae0c7f55",
                  "series": [
                    {
                      "end": 67000,
                      "found": "Pepsi",
                      "salience": 0.300785630941391,
                      "start": 64000
                    }
                  ]
                }
              }
            ]
          }
        ],
        "totalResults": 808,
        "limit": 1,
        "from": 0,
        "to": 0,
        "searchToken": "57d785e0-9213-11e7-9a71-df8e48a9af47",
        "timestamp": 1513285885
      }
    }
  }
}

The example below is a media search of the public index for instances where the words emergency, broadcast, and fire are found in any order within 10 words of one another.

query{
  searchMedia(search:{
    offset: 0
    limit: 1
    index: ["global"]
    query:{
        operator: "word_proximity"
        field: "transcript.transcript"
        inOrder: false
        distance: 10
        values: ["emergency", "broadcast", "fire"]
        }
  }) {
    jsondata
  }
}
{
  "data": {
    "searchMedia": {
      "jsondata": {
        "results": [
          {
            "recording": {
              "recordingId": "36744245",
              "fileLocation": "https://inspirent.s3.amazonaws.com/recordings/1832ec2e-7342-41e5-4396-b0d681009e21_original.mp3?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAI7L6G7PCOOOLA7MQ%2F20171214%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20171214T211646Z&X-Amz-Expires=604800&X-Amz-Signature=6865eb270e11e9cae746230ed2247a2f336edbe3e7cde199af487319facf1c43&X-Amz-SignedHeaders=host",
              "fileType": "audio/mpeg",
              "programId": "26372",
                "programName": "Morning Drive",
              "programImage": "https://s3.amazonaws.com/prod-veritone-ugc/programs/26972/y3wVqN69SreXR6FREBqQ_WINS-AM.jpg",
              "programLiveImage": "https://s3.amazonaws.com/prod-veritone-ugc/programs/25072/WpH0ipIYSzKA2Brvl0DX_BczwZNdTzmfmRbA3nTJA_MwvD0M4bRr2ELAcK8uQD_wins%2525201010.JPG",
              "mediaSourceId": "32063",
              "mediaSourceTypeId": "1",
              "isPublic": true,
              "sliceTime": 1503398731,
              "mediaStartTime": 1503398701,
              "aibDuration": 90,
              "isOwn": false,
              "hitStartTime": 1503398752,
              "hitEndTime": 1503398754
            },
            "startDateTime": 1503398731,
            "stopDateTime": 1503398791,
            "hits": [
              {
                "transcript": {
                  "source": "temporal",
                  "transcript": [
                    {
                      "hits": [
                        {
                          "queryTerm": "broadcast",
                          "startTime": 51.829,
                          "endTime": 52.51
                        },
                        {
                          "queryTerm": "fire",
                          "startTime": 52.579,
                          "endTime": 52.949
                        },
                        {
                          "queryTerm": "emergency",
                          "startTime": 53.44,
                          "endTime": 53.989
                        }
                      ],
                      "startTime": 43.01,
                      "endTime": 72.479,
                      "text": "seriously in a train crash in suburban Philadelphia early today a SEPTA commuter train struck an unoccupied parked train at a terminal in Upper Darby broadcast a fire recorded the emergency call Act of one market Acura one market town on her you know . Her and want to honor him by the N.T.S.B. is trying to determine the cause we have mostly clear skies but some low clouds a little bit a haze around seventy five degrees heading for ninety"
                    }
                  ]
                }
              }
            ]
          }
        ],
        "totalResults": 95,
        "limit": 1,
        "from": 0,
        "to": 0,
        "searchToken": "17334140-e374-11e7-b0e6-a586c4474dec",
        "timestamp": 1513286206
      }
    }
  }
}

Sample request 5: query string with negation

The example below is a media search of the private index for the word Paris when it does not appear with Las Vegas.

query{
  searchMedia(search:{
    offset: 0
    limit: 1
    index: ["mine"]
    query:{
        operator: "query_string"
        field: "transcript.transcript"
        value: "paris NOT \"las vegas\""
        }
  }) {
    jsondata
  }
}

Sample response 5: query string with negation

{
  "data": {
    "searchMedia": {
      "jsondata": {
        "results": [
          {
            "recording": {
              "recordingId": "36397022",
              "fileLocation": "https://inspirent.s3.amazonaws.com/assets/36397022/17996ce6-1d2e-43c7-9398-d6f359f56d96.mp3?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAI7L6G7PCOOOLA7MQ%2F20171214%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20171214T212013Z&X-Amz-Expires=604800&X-Amz-Signature=b7459f5c243c4c6a28a803b083c27265a605fd2d3426ba47f945a423fef6839c&X-Amz-SignedHeaders=host",
              "fileType": "audio/mp3",
              "programId": "-1",
              "programName": "Morning Chat",
              "programLiveImage": "https://s3.amazonaws.com/veritone-ugc/temp%2FprogramLiveImageURL%2F74DgqpH2RMyu2i5MtSb5_Test(1).png",
              "mediaSourceId": "-1",
              "mediaSourceTypeId": "5",
              "sliceTime": 1501005830,
              "mediaStartTime": 1501005380,
              "aibDuration": 510,
              "isOwn": true,
              "hitStartTime": 1501005841,
              "hitEndTime": 1501005842
            },
            "startDateTime": 1501005830,
            "stopDateTime": 1501005890,
            "hits": [
              {
                "transcript": {
                  "source": "temporal",
                  "transcript": [
                    {
                      "hits": [
                        {
                          "queryTerm": "Paris",
                          "startTime": 461.869,
                          "endTime": 462.159
                        }
                      ],
                      "startTime": 461.869,
                      "endTime": 491.61,
                      "text": "Paris Jackson is in the upside Wow Wow That's great Naomi star airs Tuesdays on Fox and you can follow her on Twitter at Naomi Campbell thank you so much for calling in Naomi thank you SO MUCH THANK YOU HAVE A GREAT DAY AND . The first say fifty percent . At Macy's It feels good to give back together with the help generosity of our customers and employees we gave back fifty two million dollars to charities nationwide last year"
                    }
                  ]
                }
              }
            ]
          }
        ],
        "totalResults": 18071,
        "limit": 1,
        "from": 0,
        "to": 0,
        "searchToken": "92ab8800-7a14-11e7-8c04-bd019caca41d",
        "timestamp": 1513286413
      }
    }
  }
}

Sample request 6: compound query

The following example is a media search of both indexes for either of two faces and a 20th Century Fox logo or an occurrence of Fox Sports found in text.

query{
  searchMedia(search:{
    offset: 0
    limit: 1
    index: ["global", "mine"]
    query:{
        operator: "or"
        conditions: [{
            operator: "terms"
            field: "face-recognition.series.entityId"
            values: ["3513c7da-3cde-4444-888e-ddd73e6d0cd9", "f34245b0-096b-4c3d-9646-6271d7d260d1"]
            }
            {
            operator: "or"
                conditions: [{
                operator: "term"
                field: "logo-recognition.series.found"
                value: "20th Century Fox"
                },
                {
                operator: "term"
                field: "text-recognition.series.ocrtext"
                value: "fox sports"
                }
             ]
          }
       ]
    }
}) {
    jsondata
  }
}

Sample response 6: compound query

{
  "data": {
    "searchMedia": {
      "jsondata": {
        "results": [
          {
            "recording": {
              "recordingId": "43592937",
              "fileLocation": "https://inspirent.s3.amazonaws.com/tv-recordings/17/12/14/6f0026ec-70a6-4ded-4a01-4c4d0ad4df75.mp4?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAI7L6G7PCOOOLA7MQ%2F20171214%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20171214T212939Z&X-Amz-Expires=604800&X-Amz-Signature=059b209149eaf2e4111d56d2b33d0c804f40ca3789b26736db787ca9981d8f45&X-Amz-SignedHeaders=host",
              "fileType": "video/mp4",
              "programId": "29684",
              "programName": "Weekday Afternoons",
              "programImage": "https://s3.amazonaws.com/veritone-ugc/programs/25084/XbZ1Aj4JSHmrBNIuWUaW_200px-BBC_World_News_red.svg.png",
              "programLiveImage": "https://s3.amazonaws.com/prod-veritone-ugc/programs/25084/qOyniPW3SrmTjVw7B1ow_4de7730beea8e20ba24de2be5ac03cb6.jpg",
              "mediaSourceId": "39546",
              "mediaSourceTypeId": "2",
              "isPublic": true,
                "sliceTime": 1513286310,
              "mediaStartTime": 1513286100,
              "aibDuration": 270,
              "isOwn": false,
              "hitStartTime": 1513286316,
              "hitEndTime": 1513286317
            },
            "startDateTime": 1513286310,
            "stopDateTime": 1513286370,
            "hits": [
              {
                "logo-recognition": {
                  "source": "bf5a703a-55f1-5a27-17a1-d213ae0c7f55",
                  "series": [
                    {
                      "end": 217000,
                      "found": "20th Century Fox",
                      "salience": 0.5717288255691528,
                      "start": 216000
                    }
                  ]
                }
              }
            ]
          }
        ],
        "totalResults": 4886,
        "limit": 1,
        "from": 0,
        "to": 0,
        "searchToken": "e3cc7680-e115-36e7-9e94-eba5f6b5faf7",
        "timestamp": 1513286979
      }
    }
  }
}

Sample request 7: mentions search using the "and" operator

The example below is a search for mentions with the name "Dallas Cowboys Super Bowl" and have a verification status of “Pending”.

query{
  searchMentions(search:{
    offset: 0
    limit: 1
    index: ["mine"]
    query:{
        operator: "and"
        conditions: [{
            operator: "term"
            field: "trackingUnitName"
            value: "Dallas Cowboys Super Bowl"
            },
            {
            operator: "term"
            field: "mentionStatusId"
            value: "1"
        }]
    }
  }) {
    jsondata
  }
}

Sample response 7: mentions search using "and" operator

{
  "data": {
    "searchMentions": {
      "jsondata": {
        "results": [
          {
            "id": 47569938,
            "programFormatName": "Information and News",
            "mentionDate": "2017-01-31T07:59:18.000Z",
            "mediaStartTime": "2017-01-31T07:45:01.000Z",
            "mediaId": 20017455,
            "metadata": {
              "filename": "AM-RADIO",
              "veritone-file": {
                "size": 0,
                "filename": "AM-RADIO",
                "mimetype": "audio/mpeg"
              },
              "veritone-media-source": {
                 "mediaSourceId": "14326",
                "mediaSourceTypeId": "1"
              },
              "veritone-program": {
                "programId": "3828",
                "programName": "AM-RADIO Morning Talk",
                "programImage": "https://s3.amazonaws.com/veritone-ugc/cb5e59d4-a986-4e2b-b525-482319df3350%2FbrdProgram%2F2uGsLVKsQeiKN3UuHufC_941478_10151455644772706_951533539_n.jpg",
                "programLiveImage": "https://s3.amazonaws.com/prod-veritone-ugc/cb5e59d4-a986-4e2b-b525-482319df3350%2FbrdProgram%2FwwEn3Ya9RgmMQwUEGoD1_LUkKlgZQS36ncUbY8Iz7_2520to%2520live2.JPG"
              }
            },
            "fileLocation": "https://inspirent.s3.amazonaws.com/recordings/9605ea97-87df-428e-6740-720df8b8691c_original.mp3?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAI7L6G7PCOOOLA7MQ%2F20171215%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20171215T205111Z&X-Amz-Expires=604800&X-Amz-Signature=00f62a6e2367c109320c98b9aea190cd28d82ac347eeeca030f42810b7ab75e3&X-Amz-SignedHeaders=host",
            "fileType": "audio/mpeg",
            "snippets": [
              {
                "startTime": 857.62,
                "endTime": 887.33,
                "text": "eighty first women's Australian Open final Monica Seles beat Steffi Graf four six six three six two in one thousand nine hundred twenty eight the Dallas Cowboys beat the Buffalo Bills thirty to thirteen in Atlanta running back Emmitt Smith wins the M.V.P. and fourth consecutive Super Bowl game loss to the Cowboys twenty sixteen at the one hundred fourth women's Australian Open final six three six six four that time capsule your",
                "hits": [
                  {
                    "startTime": 865.7,
                    "endTime": 865.929,
                    "queryTerm": "Dallas"
                  },
                  {
                    "startTime": 865.93,
                    "endTime": 866.07,
                    "queryTerm": "Cowboys"
                  },
                  {
                    "startTime": 872.74,
                      "endTime": 873.31,
                    "queryTerm": "Super"
                  },
                  {
                    "startTime": 873.31,
                    "endTime": 873.43,
                    "queryTerm": "Bowl"
                  }
                ]
              }
            ],
            "userSnippets": null,
            "advertiserId": 0,
            "advertiserName": "",
            "brandId": 0,
            "brandImage": "",
            "brandName": "",
            "campaignId": 0,
            "campaignName": "",
            "organizationId": 7295,
               "organizationName": "Demo Organization",
            "trackingUnitId": 10032,
            "trackingUnitName": "Dallas Cowboys Super Bowl",
            "mentionStatusId": 1,
            "mediaSourceTypeId": 1,
            "mediaSourceTypeName": "Audio",
            "mediaSourceId": 14326,
            "mediaSourceName": "AM-RADIO Morning Talk",
            "isNational": true,
            "spotTypeId": null,
            "spotTypeName": null,
            "programId": 3828,
            "programName": "AM-RADIO",
            "programImage": "https://s3.amazonaws.com/prod-veritone-ugc/cb5e59d4-a986-4e2b-b525-482319df3350%2FbrdProgram%2F2uGsLVKsQeiKN3UuHufC_941478_10151455644772706_951533539_n.jpg",
            "programLiveImage": "https://s3.amazonaws.com/veritone-ugc/cb5e52b4-a986-4e2b-b525-482319df3350%2FbrdProgram%2FwwEn3Ya9RgmMQwUEGoD1_LUkKlgZQS36ncUbY8Iz7_2520to%2520live2.JPG",
            "impressions": 1894,
            "audience": [
              {
                "gender": "men",
                "age_group": "35-44",
                "audience": 11,
                "isTargetMatch": true
              },
              {
                "gender": "men",
                "age_group": "45-49",
                "audience": 121,
                "isTargetMatch": true
              },
              {
                "gender": "men",
                "age_group": "50-54",
                "audience": 474,
                "isTargetMatch": true
              },
              {
                "gender": "men",
                "age_group": "65+",
                "audience": 95,
                "isTargetMatch": true
              },
              {
                "gender": "women",
                "age_group": "50-54",
                "audience": 19,
                "isTargetMatch": false
              },
              {
                "gender": "women",
                "age_group": "65+",
                "audience": 693,
                "isTargetMatch": false
              },
              {
                "gender": "men",
                "age_group": "55-64",
                "audience": 481,
                "isTargetMatch": true
              }
            ],
            "targetAudience": {
              "gender": 1,
              "genderName": "M",
              "ageGroup": [
                0,
                5
              ],
              "ageGroupMin": 18,
              "ageGroupMax": 0,
                "impressions": 1182
            },
            "audienceMarketCount": 3,
            "audienceAffiliateCount": 1,
            "rating": null,
            "ratings": null,
            "comments": null,
            "markets": [
              {
                "marketId": 54,
                "marketName": "Des Moines-Ames, IA"
              }
            ],
            "marketId": null,
            "marketName": null,
            "hourOfDay": 7,
            "dayOfWeek": 2,
            "dayOfMonth": 31,
            "month": 1,
            "year": 2017,
            "isMatch": true,
            "mentionStatusName": "Pending Verification",
            "complianceStatusId": null,
            "cognitiveEngineResults": null,
            "hits": 4
          }
        ],
        "totalResults": 579,
        "limit": 1,
        "from": 0,
        "to": 0,
        "searchToken": "ae882400-e1d9-11e7-947b-339cddca931e",
        "timestamp": 1513371071
      }
    }
  }
}
Additional Technical Documentation Information
Properties
1/3/2024 11:27 PM
1/3/2024 11:36 PM
1/3/2024 11:36 PM
Documentation
Documentation
000004332
Translation Information
English

Powered by