Get Information About All Services
Returns information about all services that you can perform in a Planning environment.
This API is version 11.1.2.3.600.
Required Roles
Service Administrator
REST Resource
GET /interop/rest/{api_version}/services
Note:
Before using the REST resources, you must understand how to access the REST resources and other important concepts. See Implementation Best Practices for EPM Cloud REST APIs. Using this REST API requires prerequisites. See Prerequisites.
Response
Supported Media Types: application/json
Table 9-34 Parameters
Name | Description |
---|---|
api_version |
Specific API version |
details |
In case of errors, details are published with the error string |
status |
See Migration Status Codes |
details |
In case of error, details are published with the error string |
links |
Detailed information about the link |
href |
Links to API call or status API |
action |
The HTTP call type |
rel |
Possible values: self , PBCS recreate service , PBCS reset service - details are for PBCS recreate service |
data |
Parameters as key value pair passed in the request |
Example of Response Body
The following is an example of the response body in JSON format.
{
"details":null,
"status":0,
"links":[{
"href":"https://<BASE-URL>/interop/rest/11.1.2.3.600/services",
"rel":"self",
"data":null,
"action":"GET"
},{
"href":"https://<BASE-URL>/interop/rest/11.1.2.3.600/services/PBCS/recreate",
"rel":"PBCS recreate service",
"data":null,
"action":"POST"
},{
"href":"https://<EPM-CLOUD-BASE-URL>/interop/rest/11.1.2.3.600/services/PBCS/resetservice",
"rel":"PBCS reset service",
"data":null,
"action":"POST"
}]
}
Get Information About All Services Sample Code
Java Sample – getInfoAboutAllServices.java
Prerequisites: json.jar
Common Functions: See Common Helper Functions for Java
//
// BEGIN - Get services
//
public void getServices() throws Exception {
String urlString = String.format("%s/interop/rest/%s/services", serverUrl, apiVersion);
String response = executeRequest(urlString, "GET", null);
JSONObject json = new JSONObject(response);
int resStatus = json.getInt("status");
if (resStatus == 0) {
JSONArray linksArray = json.getJSONArray("links");
System.out.println("Services list :");
JSONObject jObj = null;
for(int i=0; i < linksArray.length(); i++){
jObj = (JSONObject)linksArray.get(i);
System.out.println("Service :" + jObj.getString("rel"));
System.out.println("URL :" + jObj.getString("href"));
System.out.println("Action :" + jObj.getString("action") + "\n");
}
}
}
//
// END - Get services
//
cURL Sample – GetInfoAboutAllServices.sh
Prerequisites: jq (http://stedolan.github.io/jq/download/linux64/jq)
Common Functions: See Common Helper Functions for cURL
funcGetServices() {
url=$SERVER_URL/interop/rest/$API_VERSION/services
funcExecuteRequest "GET" $url
output=`cat response.txt`
status=`echo $output | jq '.status'`
if [ $status == 0 ]; then
echo "Services list :"
count=`echo $output | jq '.links | length'`
i=0
while [ $i -lt $count ]; do
rel=`echo $output | jq '.links['$i'].rel'`
rel=`echo "$rel" | tr -d "\""`
if [ "$rel" != "self" ]; then
echo "Service : " `echo $output | jq '.links['$i'].rel'`
echo "URL :" `echo $output | jq '.links['$i'].href'`
echo "Action :" `echo $output | jq '.links['$i'].action'`
echo ""
fi
i=`expr $i + 1`
done
else
error=`echo $output | jq '.details'`
echo "Error occurred. " $error
fi
funcRemoveTempFiles "respHeader.txt" "response.txt"
}
Groovy Sample – GetInfoAboutAllServices.groovy
Prerequisites: json.jar
Common Functions: See CSS Common Helper Functions for Groovy
def getServices() {
def url;
try {
url = new URL(serverUrl + "/interop/rest/" + apiVersion + "/services")
} catch (MalformedURLException e) {
println "Malformed URL. Please pass valid URL"
System.exit(0);
}
response = executeRequest(url, "GET", null);
def object = new JsonSlurper().parseText(response)
def status = object.status
if (status == 0 ) {
def links = object.links
println "Services list :"
links.each{
if(!it.rel.equals("self")) {
println "Service : " + it.rel
println "URL : " + it.href
println "Action : " + it.action + "\n"
}
}
} else {
println "Error occurred while fetching services list"
if (object.details != null)
println "Error details: " + object.details
}
}