Platform

Platform

A place for Apptio product users to learn, connect, share and grow together.

 View Only

How to access R12 API through Frontdoor via curl 

Thu September 28, 2017 08:47 PM

Requirements:

Basic command line know how.

Proper accounts, permissions API keys and such.

cURL 

 

Get opentoken:

curl -i -X POST https://frontdoor.apptio.com/service/apikeylogin -H 'Accept:application/json' -H 'content-type:application/json' -d '{"keyAccess":"adsfasdf-fasd-fasd-asd-fasdfa","keySecret":"fasdfasdfasdfasdfasdfasdfasdfasdfadsf"}'

 

Returns:

apptio-opentoken: asdfasdfasdfasdfasdfasdfasdfasdfasdfa

 

Get a env ID (use opentoken)

curl -i -X GET https://frontdoor.apptio.com/api/environment/apptiosupport.com/cs -H 'apptio-opentoken: asdfasdfasdfasdfasdfasdfasdfasdfasdfa' -H 'content-type: application/json'

 

Returns:

in the return text find first mention of "id":"134123413-41414-4124-4123-4123414314"

 

Get the table (use id and opentoken):

curl -i -X GET https://csbox2-r12.apptio.com/biit/api/v2/domains/support.apptio.com/projects/Cost%20Transparency/tables/Cost%20Pool%20Reference%20List/dates/Jun:FY2017 -H 'apptio-current-environment: 134123413-41414-4124-4123-4123414314' -H 'apptio-opentoken: asdfasdfasdfasdfasdfasdfasdfasdfasdfa' -H 'app-version: NA' -H 'app-type: Flagship'

 

Returns:

Table data 

 

Upload a table: version with + characters for space and one with html encoding (use opentoken and env id)

Upload a table: version with + characters for space and one with html encoding (use opentoken and env id)

curl -i -X POST 'https://csbox2-r12.apptio.com/biit/api/v2/domains/support.apptio.com/projects/Cost+Transparency/tables/Cost+Pool+Reference+List/dates/Jun:FY2017/overwrite' -H 'apptio-current-environment: 134123413-41414-4124-4123-4123414314' -H 'apptio-opentoken: asdfasdfasdfasdfasdfasdfasdfasdfasdfa' -H 'app-version: NA' -H 'app-type: Flagship' -F fileName=@upload.csv

 

curl -i -X POST 'https://csbox2-r12.apptio.com/biit/api/v2/domains/support.apptio.com/projects/Cost%20Transparency/tables/Cost%20Pool%20Reference%20List/dates/Jun:FY2017/overwrite' -H 'apptio-current-environment: 134123413-41414-4124-4123-4123414314' -H 'apptio-opentoken: asdfasdfasdfasdfasdfasdfasdfasdfasdfa' -H 'app-version: NA' -H 'app-type: Flagship' -F fileName=@upload.csv






#TBMStudio

Statistics
0 Favorited
4 Views
0 Files
0 Shares
0 Downloads

Comments

Mon June 25, 2018 06:35 AM

If you're receiving 403 errors when attempting to fetch the env ID, update your url to the following:

curl -i -X GET https://frontdoor.apptio.com/api/environment/[yourdomain.com]/main-H 'apptio-opentoken: asdfasdfasdfasdfasdfasdfasdfasdfasdfa' -H 'content-type: application/json'


#TBMStudio