How do I get the list of Topics and their Synonyms so that I can start showing up in autocomplete (suggestions)?
Below is an example you can import into Experience Designer for pulling and storing Topics and Relationships from a particular Knowledge Base:
[
{
"id": "199f1401.30978c",
"type": "inject",
"z": "baf1bce9.11ab8",
"name": "",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "",
"crontab": "",
"once": true,
"onceDelay": "60",
"x": 170,
"y": 340,
"wires": [
[
"274dfbc9.5cf034"
]
]
},
{
"id": "274dfbc9.5cf034",
"type": "function",
"z": "baf1bce9.11ab8",
"name": "Form auth request",
"func": "msg.url = `https://127.0.0.1/api/login`;\nmsg.method = \"POST\";\n\nmsg.payload = {\n username: \"cvs-dev@orbita.cloud\",\n password: \"windySc@rf73\"\n};\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 350,
"y": 340,
"wires": [
[
"fed2a180.01cfb"
]
]
},
{
"id": "fed2a180.01cfb",
"type": "http request",
"z": "baf1bce9.11ab8",
"name": "",
"method": "use",
"ret": "obj",
"url": "",
"tls": "62aec687.600178",
"x": 530,
"y": 340,
"wires": [
[
"93400296.2b285"
]
]
},
{
"id": "93400296.2b285",
"type": "switch",
"z": "baf1bce9.11ab8",
"name": "Success?",
"property": "statusCode",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "200",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "false",
"repair": false,
"outputs": 2,
"x": 680,
"y": 340,
"wires": [
[
"4dadb7c0.c2ac98"
],
[
"3ee5cea7.afd0e2"
]
]
},
{
"id": "3ee5cea7.afd0e2",
"type": "function",
"z": "baf1bce9.11ab8",
"name": "Warning",
"func": "node.warn(\"Setup error: Authentication failed.\");\n\nreturn msg;",
"outputs": 0,
"noerr": 0,
"x": 820,
"y": 360,
"wires": []
},
{
"id": "4dadb7c0.c2ac98",
"type": "function",
"z": "baf1bce9.11ab8",
"name": "Form topic API request",
"func": "msg.url = `https://127.0.0.1/api/graph/topics`;\nmsg.method = \"PATCH\";\n\nmsg.headers = {\n \"Content-Type\": \"application/json\",\n \"Authorization\": `Bearer ${msg.payload.token}`\n}\n\nmsg.payload = {\n \"q\": {\n \"projectId\": \"60c12207db4821007a3e93e4\",\n \"kgraphId\": \"60f9a70705a5ea00742c0ad3\"\n },\n \"page\": 1,\n \"limit\": 1000\n};\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 860,
"y": 320,
"wires": [
[
"6951b434.ca980c"
]
]
},
{
"id": "6951b434.ca980c",
"type": "http request",
"z": "baf1bce9.11ab8",
"name": "",
"method": "use",
"ret": "obj",
"url": "",
"tls": "62aec687.600178",
"x": 1050,
"y": 320,
"wires": [
[
"45bb1ac3.485b84"
]
]
},
{
"id": "45bb1ac3.485b84",
"type": "switch",
"z": "baf1bce9.11ab8",
"name": "Success?",
"property": "statusCode",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "200",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "false",
"repair": false,
"outputs": 2,
"x": 1200,
"y": 320,
"wires": [
[
"43d040df.32205"
],
[
"2c352c55.90b5a4"
]
]
},
{
"id": "43d040df.32205",
"type": "function",
"z": "baf1bce9.11ab8",
"name": "Store known topics",
"func": "const topics = msg.payload.result.map(rawTopic => rawTopic.name);\n\n//node.warn(topics);\n\n//global.set(\"knownTopics\", topics);\n\nreturn msg;",
"outputs": 0,
"noerr": 0,
"x": 1370,
"y": 300,
"wires": []
},
{
"id": "2c352c55.90b5a4",
"type": "function",
"z": "baf1bce9.11ab8",
"name": "Warning",
"func": "node.warn(\"Setup error: Retrieving topics failed.\");\n\nreturn msg;",
"outputs": 0,
"noerr": 0,
"x": 1340,
"y": 340,
"wires": []
},
{
"id": "80c0abf.a874a58",
"type": "comment",
"z": "baf1bce9.11ab8",
"name": "Update project ID and knowledgebase ID",
"info": "",
"x": 920,
"y": 280,
"wires": []
},
{
"id": "5ddbd556.60852c",
"type": "comment",
"z": "baf1bce9.11ab8",
"name": "Update service account",
"info": "",
"x": 360,
"y": 300,
"wires": []
},
{
"id": "cad1735f.ec52c",
"type": "inject",
"z": "baf1bce9.11ab8",
"name": "",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "",
"crontab": "",
"once": true,
"onceDelay": "60",
"x": 170,
"y": 480,
"wires": [
[
"8400f889.16bca8"
]
]
},
{
"id": "8400f889.16bca8",
"type": "function",
"z": "baf1bce9.11ab8",
"name": "Form auth request",
"func": "msg.url = `https://127.0.0.1/api/login`;\nmsg.method = \"POST\";\n\nmsg.payload = {\n username: \"cvs-dev@orbita.cloud\",\n password: \"windySc@rf73\"\n};\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 350,
"y": 480,
"wires": [
[
"32db98f8.e18d28"
]
]
},
{
"id": "32db98f8.e18d28",
"type": "http request",
"z": "baf1bce9.11ab8",
"name": "",
"method": "use",
"ret": "obj",
"url": "",
"tls": "62aec687.600178",
"x": 530,
"y": 480,
"wires": [
[
"dc4966d5.487218"
]
]
},
{
"id": "dc4966d5.487218",
"type": "switch",
"z": "baf1bce9.11ab8",
"name": "Success?",
"property": "statusCode",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "200",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "false",
"repair": false,
"outputs": 2,
"x": 680,
"y": 480,
"wires": [
[
"c0a77517.1d3668"
],
[
"9780d8f2.8d2268"
]
]
},
{
"id": "9780d8f2.8d2268",
"type": "function",
"z": "baf1bce9.11ab8",
"name": "Warning",
"func": "node.warn(\"Setup error: Authentication failed.\");\n\nreturn msg;",
"outputs": 0,
"noerr": 0,
"x": 820,
"y": 500,
"wires": []
},
{
"id": "c0a77517.1d3668",
"type": "function",
"z": "baf1bce9.11ab8",
"name": "Form relationship API request",
"func": "msg.url = `https://127.0.0.1/api/graph/relationships`;\nmsg.method = \"PATCH\";\n\nmsg.headers = {\n \"Content-Type\": \"application/json\",\n \"Authorization\": `Bearer ${msg.payload.token}`\n}\n\nmsg.payload = {\n \"action\": \"list\", // This only seems to be required for relationships, not sure why\n \"q\": {\n \"projectId\": \"60c12207db4821007a3e93e4\",\n \"kgraphId\": \"60f9a70705a5ea00742c0ad3\"\n },\n \"page\": 1,\n \"limit\": 1000\n};\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 890,
"y": 460,
"wires": [
[
"6f6ac671.2b1598"
]
]
},
{
"id": "6f6ac671.2b1598",
"type": "http request",
"z": "baf1bce9.11ab8",
"name": "",
"method": "use",
"ret": "obj",
"url": "",
"tls": "62aec687.600178",
"x": 1110,
"y": 460,
"wires": [
[
"8b3b344a.626668"
]
]
},
{
"id": "8b3b344a.626668",
"type": "switch",
"z": "baf1bce9.11ab8",
"name": "Success?",
"property": "statusCode",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "200",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "false",
"repair": false,
"outputs": 2,
"x": 1260,
"y": 460,
"wires": [
[
"a4c8ba81.8daca8"
],
[
"3fba2221.53bc4e"
]
]
},
{
"id": "a4c8ba81.8daca8",
"type": "function",
"z": "baf1bce9.11ab8",
"name": "Store known relationships",
"func": "const relationships = msg.payload.result.map(rawRelationship => rawRelationship.name);\n\n//node.warn(relationships);\n\n//global.set(\"knownRelationships\", relationships);\n\nreturn msg;",
"outputs": 0,
"noerr": 0,
"x": 1450,
"y": 440,
"wires": []
},
{
"id": "3fba2221.53bc4e",
"type": "function",
"z": "baf1bce9.11ab8",
"name": "Warning",
"func": "node.warn(\"Setup error: Retrieving relationships failed.\");\n\nreturn msg;",
"outputs": 0,
"noerr": 0,
"x": 1400,
"y": 480,
"wires": []
},
{
"id": "13359511.7b4a6b",
"type": "comment",
"z": "baf1bce9.11ab8",
"name": "Update project ID and knowledgebase ID",
"info": "",
"x": 920,
"y": 420,
"wires": []
},
{
"id": "3b8ef42e.c71bbc",
"type": "comment",
"z": "baf1bce9.11ab8",
"name": "Update service account",
"info": "",
"x": 360,
"y": 440,
"wires": []
},
{
"id": "cb4165c8.28dfe8",
"type": "comment",
"z": "baf1bce9.11ab8",
"name": "Topics",
"info": "",
"x": 150,
"y": 300,
"wires": []
},
{
"id": "6c013e76.2a7eb",
"type": "comment",
"z": "baf1bce9.11ab8",
"name": "Relationships",
"info": "",
"x": 170,
"y": 440,
"wires": []
},
{
"id": "62aec687.600178",
"type": "tls-config",
"z": "",
"name": "Orbita",
"cert": "",
"key": "",
"ca": "",
"certname": "",
"keyname": "",
"caname": "orbita.cer",
"servername": "",
"verifyservercert": false
},
{
"id": "slots",
"type": "slots",
"z": "",
"slots": []
}
]