Skip to main content

Get Best Embed Insight

This endpoint retrieves the best embed insights list. The operations of this endpoint is quite complex and returns different result structures based on the parameters passed. For example, pagination (and therefore the use of the offset parameter) is guaranteed only if the metadata and group_by parameter are not passed. If you are passing metadata you MUST pass also group_by. If you pass group_by the result will be not paginated and will contain only user defined custom embeds (not among these: 'sc_vimeo', 'sc_link', 'sc_shared_object').

HTTP Request

GET /api/v2/insight/embed/

Parameters

NameInTypeRequiredDescription
limitpathintegerfalseNumber of results to return per page
offsetpathintegerfalseThe initial index from which to return the results (only if pagination is guaranteed)
category_idpathstringfalseCan be a single category id or list (comma separated) of categories ids. 0 means empty (no category). If you use a list of category ids then any embed associated to a contribution that has at least one category_id will be returned (the filter is in OR and not in AND)
created_at__gtepathstring(date-time)falseDatetime of creation(greater than or equal to the given value)
created_at__ltepathstring(date-time)falseDatetime of creation(less than or equal to the given value)
embed_typepathstringfalseThe embed type (custom)
ranked_bypathstringfalseThe rank value to use: num_posts, num_comments, num_votes, num_clicks, num_shares (default: rank function). If a list (eg: num_posts, num_comments) the final rank will be the sum of the list components
group_bypathstringfalseEmbed_id, embed_type or metadata.TERM_KEY
metadatapathjson dictfalseA json dict containing some TERM_KEYs (eg: {"authors": ["Umberto Eco", "Neil Gaiman"], "type": "book"}). Usable only if group_by is set

Example Request

const headers = {
'Accept':'application/json',
'Authorization': 'Bearer {access_token}'
};

fetch('/api/v2/insight/embed/',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});

Responses

StatusMeaningDescriptionSchema
200OKResponse status codeInline

Response Schema with Pagination (group_by and metadata params are NOT passed)

NameTypeRequiredRestrictionsDescription
countintegerfalsenoneTotal results count
nextstring(uri)¦nullfalsenoneNext page url
previousstring(uri)¦nullfalsenonePrevious page url
resultslistfalsenoneList of results
» embedEmbedfalsenoneThe embed
» scoreintegerfalsenoneThe computed score

Example response

{
"count": "integer",
"next": "string(uri)",
"previous": "string(uri)",
"results": [
{
"embed": "{Embed}",
"score": "integer"
},
{
"embed": "{Embed}",
"score": "integer"
},
{
"embed": "{Embed}",
"score": "integer"
}
]
}

Response Schema without Pagination (group_by=embed_id passed)

NameTypeRequiredRestrictionsDescription
» embedEmbedfalsenoneThe embed
» scoreintegerfalsenoneThe computed score

Example response

[
{
"embed": "{Embed}",
"score": "integer"
},
{
"embed": "{Embed}",
"score": "integer"
},
{
"embed": "{Embed}",
"score": "integer"
}
]

Response Schema without Pagination (group_by different from embed_id passed)

NameTypeRequiredRestrictionsDescription
» resultstringfalsenoneThe grouping string result
» scoreintegerfalsenoneThe computed score

Example response

[
{
"result": "string",
"score": "integer"
},
{
"result": "string",
"score": "integer"
},
{
"result": "string",
"score": "integer"
}
]