Search API

In this article, we will explain how to implement the SDK Search API

Updated over a week ago

Search API

In this article we will outline Guidde's Search API functionality in the SDK, and the guidelines for its implementation:

API Request

The API request should be formatted in the following manner:

guidde.search({
query: string, // The text to search,
minimum 3 characters - Mandatory
tags: string[], // This parameter filters the
query by the specified tags - Optional
length: number, // This parameter controls the number of
hits to retrieve - Optional (default 5)
page: number // This parameter specifies the page to
retrieve - Optional (default 0)
})

Note: In case the request does not contain the query string the SDK will respond with the following error :

{
error: "Query string must contain at least 3 characters"
}

API Response

The API response will be formatted in the following manner:

{
nbHits: number, // number of videos matching
search criteria
videos: SearchVideo[] // videos array
}

SearchVideo

The SearchVideo response will be formatted in the following manner:

{
createdAt: string, // ISO format of creation
time (with Timezone)
creator: {
avatarUrl: string, // creator avatar URL
name: string // creator name
},
language: string, // video language
duration: number, // video duration in
seconds
id: string, // video unique ID
imageUrl: string, // image cover URL
tags: string[], // array of tags
title: string, // video title
pageUrl: string, // page URL

searchSnippet: SearchSnippetResponse[] // HTML snippets to mark the result location
}

SearchSnippetResponse

The SearchSnippetResponse provides a shortened version that can be utilized for search result display. It will be formatted in the following manner:

{
title: SearchSnippetDetails // optional
description: SearchSnippetDetails // optional
tags: SearchSnippetDetails[] // optional
transcript: SearchSnippetDetails[] // optional
}

SearchSnippetDetails

{
value: string // matched part of the string will be enclosed
into <mark> html tag,
ex: <mark>hello world</mark>
matchLevel: string // could be “full“ or “partial“ or "none"
start: number // optional, section start time
(seconds from the beginning of the video)
}
Did this answer your question?