This guide explains how to access APIs provided in this Portal.
Choose: Menu entry Sign-Up and log in
Choose: My Subscriptions from the menu
Go to Applications With Subscriptions
Click Generate Keys
Choose: APIs from the menu
select an API from the list
click subscribe with Default Application selected
Please register as a user. You can do this in using the menu entry Sign up link in the right upper corner of the menu bar.
With the entered credentials you’re able to login in the API-Portal.
To get started quickly we provide a Default Application, which can be used out of the box and you can generate access tokens for the Default Application.
In case you want to add your own Applications take a look into the chapter “Create your own Applications for API-access” below in this guide.
Click on the menu entry My Subscriptions. To secure APIs it is a general best practice to provide access via tokens. Token generation will be performed on Subscription level.
On the Subscriptions Page you choose your Application via the drop down box shown on the screenshot and then click on the button GENERATE KEYS in the right lower corner of the screen.
By default the generated key will have a lifetime of -1 seconds as shown in the field Validity Time that means the key never expires.
After the key creation the system provides you a Consumer Key, a Consumer Secret as well as the Access Token which can be used by the developer.
Now you can SUBSCRIBE an API as shown in the screens below.
Click in menu bar on the top on APIs and choose you would like to work on. In the screenshots below we choose the FaSta API as example.
Select the given API
This allows you to match an API with an Application. After you subscribed the API you can test it by clicking on API Console or CURL.
The API portal provides a comfortable way to explore your API’s and the possible operations with a build in User Interface.
Therefore select the API you would like to query either via the API’s menu entry or select it from your subscriptions. Below the general API information you will find several tabs. One of which is the API Console tab that allows you to elaborate deeper by testing the provided API Services.
The API console lists all available API operations which can be found in the screen shoot in blue.
With the Default Application and generated Keys you are able to execute queries
Note: It is important to check the Environment on which you would like to use the API. Sandbox and Production might have different Consumer key, Consumer password and Access token.
The API Console provides also additional information such as example results to show the result schema and input parameter choices.
It also prepares Curl commands right for you to copy and paste or lets you execute your request within the User Interface with a click on “Try it out”
The API Portal features the possibility to host multiple versions of the API in parallel. This is commonly used for Test and Staging environment. Within My Subscription you have the possibility to create tokens and credentials for each environment individually the environments are called “Production” and “Sandbox”. The choice whether to use Production and Sandbox systems is up to your decision but on more complex API’s it is certainly recommended.
The generated key of Sandbox and Production environment are usually different.
An application does group APIs und one security set. The can share a Consumer key, Consumer password, Access token. This reflects basically your application as a developer who can take advantage of multiple APIs with one security access set.
After sign-up / Login you’re able to register your Applications that will consume APIs.
The advantage in using Applications is that you can access one or multiple APIs with one set of security credentials (Client id and Token). Applications are a concept to group APIs together.
Note: To get started quickly we provide a Default Application, which can be used out of the box and you can generate access tokens for the Default Application.
In case you would like to register your own Application or list existing ones, please use the menu entry My Applications in the menu bar on the top of this screen. When you register a new Application please provide the name as a mandatory field and optional a description.
At the moment of writing you can leave the Callback Url field blank since it is not used by the OPEN API Platform yet.
To test your new created tokens one can execute the following Curl command in a Terminal application of your choice. Please note that the authorization information will be passed as header information as follows (adapt the example to your own URL and security information).
curl -X GET --header „Accept: application/json“ --header „Authorization: Bearer a16f23aad42ad5db1d36881d9cb432a7“ „https://api.deutschebahn.com/fasta/v1/stations/1“
The API Console as well as the API portal itself relies on Swagger files to document and exchange information about the API.
You can always download the given API swagger file from the API section in the portal.
Below the menu tab Documentation is particular additional information for an API available.
Below the menu tab API Console it is possible to download the API definition as Swagger file.
In case you want to publish new token information you are welcome to click on RE-GENERATE to create a new set. But keep in mind that this operation will invalidate old tokens.
You are welcome to reach out to us at any time. Either via email: email@example.com or on Twitter: @dbopendata or #dbopendata.