In a previous question, I can get the apiKey for interacting with the MessageHub management api.
I'm not binding to this service to a Bluemix application, so I don't have access to the VCAP_SERVICES environment variable in my application.
I would like to retreive the service credentials programatically. I think this may be a generic Bluemix cf api question rather than a MessageHub question.
How can I retrieve the service credentials using an API call?
Sadly because BlueMix runs a version of Cloud Foundry that is 6 months out of date, you can't use the List Service Keys endpoint.
Your only alternative is to bind it to some app (maybe not even a real app) to extract the credentials.
There is an argument that humans needing the credentials for a service is an anti-pattern, but there are plenty of use cases where it is necessary.
The https://apidocs.cloudfoundry.org/245/service_instances/list_all_service_keys_for_the_service_instance.html API worked for me.
Using the cf-python-client library: