Related Topics
Get similar tags or categories based on shared qualities. For a target tag, this algorithm finds other tags from content that shares that target tag.
Examples include:
- Related Categories
- Discover Similar Genres
- Explore Related Topics
- Other Interests You Might Like
- Similar Tags
Code Example
Take a look at this example of using the Related Topics endpoint, and read the detailed description below explaining each part of this code.
const data = JSON.stringify({
"object": {
"id": "Sushi",
"type": "tag"
},
"content_object_type": "company"
});
const xhr = new XMLHttpRequest();
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("GET", "https://api.pipeless.io/v1/apps/123/algos/recommendations/related-tags");
xhr.setRequestHeader("accept", "application/json");
xhr.setRequestHeader("content-type", "application/json");
xhr.send(data);
import requests
url = "https://api.pipeless.io/v1/apps/123/algos/recommendations/related-tags"
payload = {
"object": {
"id": "Sushi",
"type": "tag"
},
"content_object_type": "company"
}
headers = {
"accept": "application/json",
"content-type": "application/json"
}
response = requests.request("GET", url, json=payload, headers=headers)
print(response.text)
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://api.pipeless.io/v1/apps/123/algos/recommendations/related-tags")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
request["content-type"] = 'application/json'
request.body = "{\"object\":{\"id\":\"Sushi\",\"type\":\"tag\"},\"content_object_type\":\"company\"}"
response = http.request(request)
puts response.read_body
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.pipeless.io/v1/apps/123/algos/recommendations/related-tags",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_POSTFIELDS => "{\"object\":{\"id\":\"Sushi\",\"type\":\"tag\"},\"content_object_type\":\"company\"}",
CURLOPT_HTTPHEADER => [
"accept: application/json",
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"object\":{\"id\":\"Sushi\",\"type\":\"tag\"},\"content_object_type\":\"company\"}");
Request request = new Request.Builder()
.url("https://api.pipeless.io/v1/apps/123/algos/recommendations/related-tags")
.get()
.addHeader("accept", "application/json")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
curl --request GET \
--url https://api.pipeless.io/v1/apps/123/algos/recommendations/related-tags \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{"object":{"id":"Sushi","type":"tag"},"content_object_type":"company"}'
Here we're running this algo on App ID "123" where an object tag "Sushi" is being used to find similar tags. Content object type "company" will look at other companies (e.g. restaurants) that have tags like Sushi and find other related tags associated with those restaurants.
To summarize, this example is: "get tags similar to Sushi - tags that are applied specifically to companies"
Tutorial Example
You can see this API endpoint in action using our tutorial restaurant dataset here:
Related Topics Tutorial Example
API Reference Documentation
You can read the reference docs for this endpoint here:
Get Related Tags
Updated almost 2 years ago