PI REST Adapter - Connect To Concur
PI REST Adapter - Connect To Concur
This blog is part of a collection of blog entries that shows architectural concepts and configuration of the SAP
PI REST Adapter. We also added some sample scenarios to make it easier for you to understand how your
scenario can be implemented using the PI REST Adapter.
If you haven’t done so far, best is to start with the very first blog PI Rest Adapter - Don't be afraid
within the blog series covering the concepts of the REST adapter. A complete list of all blog
entries can be accessed from here PI REST Adapter - Blog Overview.
The current blog describes how to connect to Concur - SAP's cloud solution for travel and expense
management - via its REST API. I primarily focus here on how to authenticate to Concur's applications.
Basically, you need an access token which needs to be passed to the API in the request header. Here, Concur
supports different OAuth 2.0 Authorization flows. For message exchange, the so called Native Flow is best
suited. As of release 7.31 SP17 / 7.4 SP12, the REST adapter supports the configuration of the OAuth 2.0
Native Flow for Concur. Alternatively, if you are not on the latest SP, you can pass the access token in the http
header by defining custom http header. This however needs at least 7.31 SP15 / 7.4 SP10, see also PI REST
Adapter - Define custom http header elements. In this blog I will describe all options.
Preparation
If you like to get familiar with Concur's REST API, you can create your own developer sandbox at Concur
Developer Center. There, you also find the API reference guide. If you sign up for a new sandbox, in the
welcome page you get the consumer key, the consumer secret, and the access token of your account
displayed. You need them to authenticate to your sandbox when calling the APIs. If you aren't able to recall
them, or you need to refresh them, you can navigate to Administration --> Company --> Web Services, and
select Register Partner Application.
Here, you can either create a new Application Registration or modify the existing one. If you have chosen
Modify, you can display the consumer key, and the consumer secret or create a new secret.
If you cannot recall the access token, you can request a new one using the Advanced Rest Client application
in your Chrome browser by calling the token service of Concur, i.e., https://www.concursolutions.com/net2/
oauth2/accesstoken.ashx. In the header, specify the consumer key (header element X-ConsumerKey), when
prompted maintain user and password. In the response of the call, a new access token is provided as well as
its expiration date. Usually, the access token is valid for one year.
As mentioned above, we do support different options for handling the access token in order to authenticate and
authorize at Concur's APIs:
Maintain the receiver channel as follows. Switch to tab General below tab Adapter-Specific. Here, you don't
need to choose any authentication nor OAuth settings.
Switch to tab HTTP Headers, and add a new entry into the table with Header Name Authorization and Value
Pattern OAuth <your access token>.
Maintain the receiver channel as follows. Switch to tab General below tab Adapter-Specific. Check flag
Authorize with OAuth. From the drop down menus select the Flow OAuth 2.0 Native Flow for Concur and the
Access Token Source Provide Access Token directly. As Access Token parameter maintain your valid access
token.
Switch to tab HTTP Headers. As you can see, there is no need to maintain any custom http header, at least not
for the authentication towards Concur.
I hope this blog was helpful to understand how to authenticate to Concur's REST API. If you like to learn more,
check out the other blogs in the series, accessible from the main blog PI REST Adapter - Blog Overview.