Skip to main content

Easy description to get an accessToken

Step 1.

Info: The Bearer Token is now valid for 7 days and no longer 21 days, so adjust the code accordingly.

Get your ConsumerKey & ConsumerSecret by creating your App in "My Apps"

Step 2.

Encode ConsumerKey & ConsumerSecret (output will be used in curl-request):

$ echo -n ConsumerKey:ConsumerSecret | base64

 

Step 3.

Use Encoded ConsumerKey & ConsumerSecret in curl-request:
 

curl -X POST \
  'https://api.srgssr.ch/oauth/v1/accesstoken?grant_type=client_credentials' \
  -H 'Authorization: Basic <Encoded Consumer Key & Consumer Secret>' \
  -H 'Cache-Control: no-cache' \
  -H 'Content-Length: 0' \
  -H 'Postman-Token: [token]'

 

Step 4.

Use received access_token in curl request:
 

curl -X GET \
  'http://api.srgssr.ch/rts/archives/v2/audios' \
  -H 'Authorization: Bearer <access_token>' \
  -H 'Cache-Control: no-cache' \
  -H 'Postman-Token: [token]'

 

Ralph from our community has described a very easy to use documentation "how to get an accessToken" 

thanks, Ralph!

About us

The SRG SSR API team is proud to share our data for the friends, community, customer and partners.