How do I set API authentication?

You can log in to Acoustic Content with Rest APIs and wchtools by creating an API key. The API Key is linked to your account whether the account has federated authentication or not. But if your content hub account has federated authentication, you must use the API key when you log in to the hub with the REST APIs or with wchtools..

Acoustic Content supports API log in by using the Bluemix® API key. API keys often act as both a unique identifier and a secret token for authentication. Usually, an API key has a set of access rights specific to the identity associated with the API key.

As an Administrator, you can create an API key in IBM Cloud that can be linked to your account. For detailed steps on how to create an API key, see Managing user API keys in IBM Cloud.

After you create the API Key, you can log in to Acoustic Content with the REST APIs and wchtools by providing the following credentials:
  • User ID: apikey
  • Password: the value of the API key that was presented to you, when you created the API key in IBM Cloud.
For example, in your curl commands used for API login instead of
curl -v -u IBMidUser@domain.com:password https://my.digitalexperience.ibm.com/api/login/v1/basicauth
You must log in with the following command:
curl -v -u apikey:{insert your api key value here}  https://my.digitalexperience.ibm.com/api/login/v1/basicauth
Where the string apikey is used as your userid and you must provide your api key value that was presented to you, when you created the API key in IBM Cloud.

The response to the log in request contains a Set-Cookie header containing the proper x-ibm-dx-user-auth value for the user to set in future requests. The subsequent requests are authenticated with the included x-ibm-dx-user-auth header.

WCH provides a more convenient alternate method to authenticate which can be useful when using applications such as Webhooks. You can avoid the step of sending in a login request separately and can set the basicauth header directly as a part of any request you send to the Content Hub. The response includes the Set-Cookie headers containing the proper x-ibm-dx-user-auth value, which is used to authenticate subsequent requests you send. For example, you can set your credentials and basicauth header in an authoring request as follows
curl -v -u apikey:{insert your api key value here} https://my.digitalexperience.ibm.com/api/authoring/v1/assets
For more information about authentication and making API requests see IBM API explorer.