Find Data Source Servers
Returns a list of data source servers based on search criteria
Method
- API Section: /API3/dataSources
- API Version: 3.0
- From Release: 2023.10
- Usage: REST API and Client SDK libraries. REST APIs via POST actions only.
- Usage by:
- Enterprise Admin
- Domain Admin
- Pro
- Analyst
- Viewer
Method Signature
Input Parameters
Name
searchCriteria
Object Type
Description
The search criteria for finding materialized data elements.
Output Response
Successful Result Code
200
Response List Type
Description of Response Type
The search results object.. Note that the response is returned as a list of items of this object type.
Examples
Setting Data Model Security (JavaScript):
This example demonstrates how to set hierarchy, measure adn member level security in a data model programmatically.
The example uses API authentication driven from JavaScript. See Authentication APIs for alternatives.
// URL of the Pyramid installation and the path to the API 3.0 REST methods
var pyramidURL = "http://mysite.com/api3/";
// step 1: authenticate admin account and get token
// NOTE: callApi method is a generic REST method shown below.
let token = callApi(“authentication/authenticateUser”,{
“userName”:“adminUser”,
“password”:“abc123!”},
“",false);
log(“got token “+token);
//get database’s system ID
let databaseId = database[0].itemId
//step 2: find model by name for the chosen database
let model= callApi(“dataSources/findModelConnection”,{
“serverSearchCriteria”:{
“searchValue”:“Pyramid IMDB”
},
“databaseSearchCriteria”:{
“searchValue”:“PyramidDemo”
},
“modelSearchCriteria”:{
“searchValue”:“PyramidDemo”
}
},token);
//get model’s system ID
let modelId = model[0].modelId
//step 3: find role by name
let role= callApi(“access/findRoles”,{
“searchValue”:“role 1”
},token);
//get role’s system ID
let roleId = role[0].roleId
//step 4A: adding member security to the model by specific selection
// set this role to see 2009 and 2010 (and by definition hide any other year)
let addMembersSecurityToModel= callApi(“dataSources/addMembersSecurity”,{
“modelId”:modelId,
“roleId”:roleId,
“enableMode”: true,
“hierarchyUniqueName”: “[Date].[year]”, //this is the unique name of the parent hierarchy
“members”:[“2009”, “2010”] //list of members (using their captions)
},token);
//step 4B: adding member security to the model by script
// set this role to see any country where the non empty cross join
// to the ‘user’ column in the ‘security’ table matches the logged in user’s username (using the username function)
let addMembersSecurityToModel= callApi(“dataSources/addMembersSecurity”,{
“modelId”:modelId,
“roleId”:roleId,
“enableMode”: true,
“hierarchyUniqueName”: “[Geography].[Country]”, //this is the unique name of the parent hierarchy
“script”:“NonEmpty([Geography].[Country].AllMembers, {StrToMember([Security].[User],UserName())})” //logical PQL script for defining a list of members
},token);
//step 4C: adding member security to the model by script
// set this role to see any records in the model where it is inherently filtered (inner joined)
// against the value of the currently logged in user’s name in the ‘userIds’ column in the ‘Org’ table (from the username function)
let addMembersSecurityToModel= callApi(“dataSources/addMembersSecurity”,{
“modelId”:modelId,
“roleId”:roleId,
“enableMode”: true,
“hierarchyUniqueName”: “[Security].[User]”, //this is the unique name of the parent hierarchy
“script”:“StrToMember([Org].[UserIds],UserName())” //logical PQL script for defining a list of members
},token);
//step 5: adding hierarchy security to the model
// set this role to NOT see the state hierarchy in the customer dimension/table
let addHierarchySecurityToModel= callApi(“dataSources/addHierarchySecurity”,{
“modelId”:modelId,
“roleId”:roleId,
“enableMode”: false,
“uniqueNames”: ["[Customer].[State]”] //this is the unique name of the hierarchy, in a list
},token);
//step 6: adding measure security to the model
// set this role to see the the cost measure in the model (and by definition to hide all other measures)
let addMeasureSecurityToModel= callApi(“dataSources/addMeasureSecurity”,{
“modelId”:modelId,
“roleId”:roleId,
“enableMode”: true,
“uniqueNames”: ["[measures].[Cost]”] //this is the unique name of the measure, in a list
},token);
// ##### optional generic login method for debugging ##############
function log(msg){
document.write(msg);
console.log(msg);
}
// ##### generic REST API calling method ##############
function callApi(path,data,token=”",parseResult=true){
var xhttp = new XMLHttpRequest();
xhttp.open(“POST”, pyramidURL+path, false);
xhttp.setRequestHeader(“paToken”,token)
xhttp.send(JSON.stringify(data));
if(parseResult){
return JSON.parse(xhttp.responseText);
}else{
return xhttp.responseText;
}
}
</code></pre></details>
Code Snippets
Use the Authentication API methods to generate an access ‘key’ or ’token’ for use in code as shown below.
TypeScript
Curl
Java
C#
Python
PHP
