Get API Versions for Profitability and Cost Management REST APIs
Returns information about which versions are available and supported. Multiple versions might be supported simultaneously.
Note:
An API version is always supported even when deprecated.
Required Roles
Service Administrator, Power User, User, Viewer
REST Resource
GET /epm/rest/
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 24-2 Parameters
Name | Description |
---|---|
details |
In case of errors, details are published with the error string |
status |
See Migration Status Codes |
items |
Version of the API you are developing with |
version |
The version, such as v1 |
lifecycle |
Possible values: active, deprecated |
isLatest |
Whether this resource is the latest, true or false |
Example of Response Body
The following shows an example of the response body in JSON format.
{
"items": [{
"isLatest": false,
"lifecycle": "deprecated",
"version": "11.1.2.4.000",
"links": [{
"href": "https://<BASE-URL>>/epm/rest/11.1.2.4.000",
"rel": "canonical"
}, {
"href": "https://<BASE-URL>>/epm/rest/v1",
"rel": "successor-version"
}]
}, {
"isLatest": true,
"lifecycle": "active",
"version": "v1",
"links": [{
"href": "https://<BASE-URL>>/epm/rest/v1",
"rel": "canonical"
}, {
"href": "https://<BASE-URL>>/epm/rest/11.1.2.4.000",
"rel": "predecessor-version"
}]
}],
"links": [{
"href": "https://<BASE-URL>>/epm/rest/11.1.2.4.000",
"rel": "canonical"
}, {
"href": "https://<BASE-URL>>/epm/rest/v1",
"rel": "current"
}]
}
Java Sample – GetRestAPIVersionsInfo.java for Profitability and Cost Management
Prerequisites: json.jar
Prerequisites: See Profitability and Cost Management Common Helper Functions for Java
public void getRestAPIVersionsInfo() throws Exception {
String urlString = String.format("%s/epm/rest", serverUrl);
String response = executeRequest(urlString, "GET", null, "application/json");
System.out.println("Response String : " + response);
JSONObject jsonObj = new JSONObject(response);
JSONArray itemsArray = jsonObj.getJSONArray("items");
System.out.println("Details : " + itemsArray.toString());
}
cURL Sample – GetRestAPIVersionInfo.sh for Profitability and Cost Management
Common functions: See Profitability and Cost Management Common Helper Functions for cURL
funcGetRestAPIVersionInfo()
{
url=$SERVER_URL/epm/rest/$API_VERSION
funcExecuteRequest "GET" $url "application/x-www-form-urlencoded"
status=$?
echo "status code :$status"
output='cat response.txt'
if [ $status == 200 ]; then
echo "Version $API_VERSION details :"
count='echo $output | jq '.links | length''
i=0
while [ $i -lt $count ]; do
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 ""
i='expr $i + 1'
done
else
error='echo $output'
echo "Error occurred. " $error
fi
funcRemoveTempFiles "respHeader.txt" "response.txt"
}
Groovy Sample – GetRestAPIVersionsInfo.groovy for Profitability and Cost Management
Prerequisites: json.jar
Common functions: See Appendix C: Common Helper Functions for Groovy.
def getRestAPIVersionsInfo() {
def url;
def response;
try {
url = new URL(serverUrl + "/epm/rest");
} catch (MalformedURLException e) {
println "Malformed URL. Please pass valid URL"
System.exit(0);
}
response = executeRequest(url, "GET", null, "application/json");
def object = new JsonSlurper().parseText(response)
if(object != null) {
def items = object.items
println "Rest API Versions Info : " + items
} else {
println "Error occurred while fetching rest api versions details"
}
}