Introduction to the Omnisearch API
No items found.
Published:
August 20, 2024
Topic:
Deep Dive
One of the key differentiating features of Omnisearch is that it provides an API which can be used to integrate video search into your own applications. This allows you to expose video search functionality to your own end users directly. The API calls that we’ll cover in this post can be viewed in your dashboard after registration. For now we’re going to make API calls through the cURL command, though keep in mind that JavaScript and Python wrapper packages are in development.
The API Key
Your API key is the single most important object for making calls to the Omnisearch API. The API key is unique, and is used to authenticate and meter all your requests. To obtain a key, create an account, log in, and find it in the dashboard under YOUR API KEY. This will be needed for all the requests we make.
Examples
Let’s first test out the API key. We’ll make a call to the /hello endpoint, like so:
curl -X GET "https://api.captionapp.net/v1/hello?key={YOUR_API_KEY}"
This should return:
{
"message": "Hello, welcome to Omnisearch."
}
If all is good, we can proceed, and actually try to index a video.
curl -X POST -H "Content-Type: application/json" -d '{"url": "YOUR_VIDEO_URL"}' "https://api.captionapp.net/v1/document/video?key={YOUR_API_KEY}"
Keep in mind that the URL needs to be to the file itself. So links to Google Drive or YouTube won’t work. Though don’t worry, these are in the works as well. The return value should be:
{
"message": "Enqueued video for processing. Check the progress of the job at https://dashboard.captionapp.net/admin/indexing-status."
}
This leads you to the Indexing status page. Since processing takes time, we need to wait for it to complete before we’re able to query the documents.
Once we see the task as completed, we can do the following:
curl -X GET "https://api.captionapp.net/v1/document/search/voltaire?key={YOUR_API_KEY}"
which will find all the mentions of the term “voltaire“ in your collection. Feel free to experiment with any search term you care about. And also note that you’ll receive all the timestamps that the term was mentioned at.
This about sums it up, keep checking the site for awesome new updates.