In this article:
Introduction
Apptio supports three APIs: the Apptio Platform API, the Frontdoor API, and the DataLink API.
This document provides Apptio Platform API demo scripts in one or two commonly-used scripting languages, as well as instructions on how to set up the demo scripts for testing. It also provides users with an orientation to the mechanics of using the API so that they can then apply the learning to their own scripted solutions.
Datalink uses the Apptio API to transport data. The Apptio API can also be used independently for data upload or download operations (for example, batch operations), which Datalink doesn't readily support. Use of the API is more involved and usually requires some scripting or programming background to implement and maintain. Therefore, it is recommended to use Datalink unless you have advanced needs and resources to implement and maintain the API implementation.
The Apptio API is distinct from the Datalink API: The Apptio API is used to upload to Apptio project tables, or download from Apptio project tables (including those in reports), and it is what Datalink uses under the hood. The Datalink API is used to automate Datalink agent connector execution. To learn more about the Datalink API, refer to DataLink API Usage & Sample Scripts.
The script attached to this article has been tested against the following specific releases, however, it should work with other releases too:
Basic operations
The first demo script is named ApptioAPI_Demo_Basic_v2.ps1. It is written in Windows PowerShell, which is widely available on Windows systems, can leverage .NET libraries, and can be used by software, such as SQL Server Management Studio, to implement load and extraction from SQL Server. (This subject will be covered in more detail in future releases of this document.)
The script is attached and commented. The usage is as follows; This is displayed if the script is executed with no arguments:
You need to specify -up or -down.
Usage (using API Keys):
ApptioAPI_Demo_Basic_v2.ps1 -help
ApptioAPI_Demo_Basic_v2.ps1 -down [-APIURL "valid API URL"]
[-downtimeperiod "Apptio time period"]
[-downloadfolder "folder to download to"] [-downfile "file name"]
ApptioAPI_Demo_Basic_v2.ps1 -up [-v1] [-upfile "path to file to upload"]
[-apptiohost "https://domain-r12.apptio.com"]
[-domain "domain.com"] [-project "Project Name"] [-table "Table Name"]
[-uptimeperiod "Apptio time period"] [-transformation overwrite | append]
Usage (using username/password auth):
ApptioAPI_Demo_Basic_v2.ps1 -help
ApptioAPI_Demo_Basic_v2.ps1 -user "username@domain.com" -pass "password"
-down [-APIURL "valid API URL"]
[-downtimeperiod "Apptio time period"]
[-downloadfolder "folder to download to"] [-downfile "file name"]
ApptioAPI_Demo_Basic_v2.ps1 -user "username@domain.com" -pass "password"
-up [-v1] [-upfile "path to file to upload"]
[-apptiohost "https://domain-r12.apptio.com"]
[-domain "domain.com"] [-project "Project Name"] [-table "Table Name"]
[-uptimeperiod "Apptio time period"] [-transformation overwrite | append]
It is possible to provide combinations of the optional arguments and execute without modification. However, if you want to use only the "-up" and "-down" flags, you can edit the script to modify the necessary variables. Following is an explanation of the variables, what they contain, and what you may need to do for setup.
Authentication Arguments
The following arguments support API Keys authentication. This is the preferred method for use with v12 environments.
-pubkey "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" This argument supplies a valid API Key public key. See API keys and Frontdoor: Overview and FAQs for more information on how to obtain a public key.
-secret "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" This argument supplies a valid API Key secret key. See API keys and Frontdoor: Overview and FAQs for more information on how to obtain a secret key.
-envid "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" This argument supplies a valid v12 environment ID. See API: Get Frontdoor Environment Information for information on how to obtain this ID using the API. You can also request it from Apptio Support or your CSM or CSE.
The following arguments support username / passsword authentication. This is for backward compatibility with r11 environments and should not be used in v12 environments.
-user "user@domain.com" -pass "password" These arguments specify a user account that has access to the project that contains data to download and the password for that account. Remember that if you create a new account to support this, you will need to edit the account after creation to uncheck the "Single-Use Password" check box, or the API may not respond.
Download Arguments
-APIURL "valid API URL" This argument specifies a valid, quoted, Apptio API URL. This can be obtained from almost anything in Apptio by clicking the export icon, which appears as follows:

This icon appears in the r11 Data tab of the studio in association with any Transform Table or Raw Table view, or via the "Export" button in the ribbon of the TBM Studio in r12 when a table is selected.
In reports, you can access it by right clicking at the base of a table (for example, in the totals row area).
-downtimeperiod "Apptio time period" This argument specifies a correctly-formatted Apptio time period to download from (for example, Aug:FY2016). This will replace any time period that happens to be in the APIURL.
[-downloadfolder "folder to download to"] This argument specifies the folder for the downloaded data.
[-filename "file name"] This argument specifies the name for the file to which the data is downloaded.
Upload Arguments
[-v2] This argument specifies use of the API v2 URL for upload. This is optional and is only necessary in specific situations.
[-upfile "path to file to upload"] This argument specifies the path to a file that is to be uploaded.
[-apptiohost "https://domain-dev.apptio.com"] This argument specifies the Apptio host instance where the project the file is being uploaded into resides.
[-domain "domain.apptio.com"] This argument specifies your company's domain.
[-project "Project Name"] This argument specifies the project name into which the file will be uploaded.
[-table "Table Name"] This argument specifies the name of the table into which the data is to be loaded.
[-uptimeperiod "Apptio time period"] This argument specifies a correctly-formatted Apptio time period into which to upload (for example, Aug:FY2016).
[-transformation overwrite | append] This argument specifies whether or not the table should be overwritten or appended to.
(Back to top)
This article is open for your feedback. At the bottom of this screen, click Add a comment.