Skip to main contentIBM Video Streaming Developers

Testing APIs

Test an API from command line (with curl)

Get an access token

The simplest way to obtain an access token for testing purposes is to use the implicit OAuth 2.0 flow. This flow allows clients to get access tokens directly from the auth endpoint. However, for production purposes it is not recommended due to the inherent risks of returning access tokens in an HTTP redirect without any confirmation that it has been received by the client.

After logging in, the browser is redirected to a special URL (defined by the client), passing the Access Token in the URL. As you can see in the examples below, you should use Authorization HTTP header with the token in the requests: Authorization: Bearer 3c2573673b782f6544405a22636f3d5d3b6f3950

Create a channel (POST)
curl \
-i \
-H "Authorization: Bearer 3c2573673b782f6544405a22636f3d5d3b6f3950" \
-d "title=Whatever+Test+1234" \
HTTP/1.1 201 Created
{"channel":{"id":"13091307","title":"Whatever Test 1234","url":"whatever-test-1234","tiny_url":""}}