TIH Developer Portal enables you to create compelling solutions to deliver an enhanced experience for your visitor. This guide to the TIH Developer Portal will help you get started:
- Registering for a developer account
- Obtaining an API Key
- Obtaining an OAuth Authentication Token
1. REGISTERING FOR A DEVELOPER ACCOUNT
To gain access to TIH APIs, you can either register for a TIH Business account or a TIH Developer account. Should you be a technology/ software company or a developer representing a business, you are recommended to register for a TIH Business account.
2. OBTAINING AN API KEY
To retrieve your API Key, sign in to your account and navigate to “My Settings”. Check on “I would like to have an API Key” and click save. Should you be registered as Business account, you will need to be a Business Product Admin before seeking request.
The API Key grants access to the following TIH APIs:
- Content User API
- Media User API
- 3rd Party Information Sources API
- Enhanced Navigation Services API
- Visit Singapore Account API
- Recommendation Engine API
- Itinerary Planner API
Each API page provides description of each API and tips on the best ways to use each API. Experiment with the APIs in the “Try it out” section located within these API pages.
3. OBTAINING AN OAUTH AUTHENTICATION TOKEN
Besides the API Key, an OAuth Authentication Token is required to
- Contribute information via the Content Provider APIs and Media Provider APIs
- Access the Visit Singapore Account APIs, which enable a seamless log in for your customers
- Access the Recommendation Engine APIs which let you provide recommendation services to your customers
- Access the Itinerary Planner APIs which empower your visitors to create their own Singapore itinerary
You will need to submit the application form to the TIH helpdesk at stb_tih@stb.gov.sg
Once the request has been approved, a ClientId and ClientSecret will be emailed to your registered email address.
After receiving the ClientId and ClientSecret, you will need to encode the ClientId:ClientSecret combination in base64 to obtain an access token. You can use these tools available online.
Head to the respective OAuth accessToken API page below, and obtain the OAuth Authentication Token with the following header and request parameters:
- TIH OAuth accessToken API page (For Content Provider APIs, Media Provider APIs and Recommendation Engine APIs)
- Visit Singapore Account OAuth accessToken API page (For Visit Singapore Account APIs)
HEADER | |||
Parameters | Format / Example | ||
Authorization | Basic <base64 encoding of "clientId:clientSecret"> For example: Basic UkV5dVA3SFIThHNG01eENISWZQaHNoTEczOHc6dXkxaUwIyM0RoTQ== |
||
ContentType | application/x-www-form-urlencoded | ||
REQUEST | |||
Parameters | grant_type | ||
Description | Grant Type | ||
Mandatory | Yes | ||
Example | client_credentials |
From the JSON response, you can get the access token from the “access_token” value, which expires in 1 hour. With this access token, you can use any of the following APIs:
- Content Provider API
- Media Provider API
- Recommendation Engine API
- Visit Singapore Account API
- Itinerary Planner API
To use the above APIs, you will need to pass the access token as part of the “Authorization” parameter in the request header.
If your access token has expired, you can obtain a new token using accessToken API or refreshToken API. To use refreshToken API, pass the token you received earlier as the “refresh_token” request parameter.
- TIH accessToken API or TIH refreshToken API (For more details, please refer to the OAuth Authentication Technical Integration Guide.)
- Visit Singapore Account accessToken API or Visit Singapore Account refreshToken API (For more details, please refer to the VS Account Technical Integration Guide.)
We hope that the above will help you get started on utilising our APIs to support your business initiatives and needs.
For assistance or enquiries, reach us via our Contact Info page.