Gets tag data
{ getTag }
Returns the Tag with its metadata
Method
/API2/content/getTag
Input Parameters
Name
tagId
Type
string
Description
The system tag ID
Output Response
Successful Result Code
200
Response Type
Description of Response Type
The tag object used to capture a tag's settings.
Examples
Content and Tag Operations (JavaScript):
This example demonstrates how to find item's and the manipulation of content tags.
The example uses API authentication driven from JavaScript. See Authentication APIs for alternatives.
// URL of the Pyramid installation and the path to the API 2.0 REST methods
var pyramidURL = "http://mysite.com/api2/";
// step 1: authenticate admin account and get token
// NOTE: callApi method is a generic REST method shown below.
let token = callApi("auth/authenticateUser",{
"data":{
"userName":"adminUser",
"password":"abc123!"
}
},false);
//step 2: add a tag to the system
let addedTag = callApi("content/addTag ",{
"tagData": {
"tagDescription":tagName,
"tagType":0
},
"auth": token
});
let tagId = addedTag.data.modifiedList[0].id;
//step 2: find/search for a Discover item called "sales figures"
let dataDiscovery = callApi("content/findContentItem",{
"searchParams": {
"searchString": "sales figures",
"filterTypes": [3],
"searchMatchType": 2,
"searchRootFolderType":0
},
"auth": token // admin token generated above
});
let itemId = dataDiscovery.data[0].id;
//step 3: bind the new tag to this report
let itemIds = callApi("content/addTagToItem ",{
"tagUsageApiData": {
"itemId":itemId,
"tagId":tagId
},
"auth": token
});
//step 4: get a specific tag object using its tag id
let getTag = callApi("content/getTag",{
"tagId": tagId,
"auth": token
})
//step 5: remove the tag from a specific content item
let removeTagFromItem = callApi("content/removeTagFromItem ",{
"tagUsageApiData": {
"itemId":itemId,
"tagId":tagId
},
"auth": token
});
//step 6: delete the tag
let deleteTag = callApi("content/deleteTag ",{
"tagId": tagId,
"auth": token
});
//step 7: permanently delete the content item
let purgeContentItems = callApi("content/purgeContentItems",{
"itemIds":[folderCreation.modifiedList[0].id],
"auth": token
});
// ##### optional generic logging method for debugging ##############
function log(msg){
document.write(msg);
console.log(msg);
}
// ##### generic REST API calling method ##############
function callApi(path,data,parseResult=true){
var xhttp = new XMLHttpRequest();
xhttp.open("POST", pyramidURL+path, false);
xhttp.send(JSON.stringify(data));
if(parseResult){
return JSON.parse(xhttp.responseText);
}else{
return xhttp.responseText;
}
}