0
votes

Is it possible to create an API Key for an application in IBM IoT Foundation using REST API?

I have seen that I can create it by logging into the IBM IoT Foundation Dashboard and clicking on the API Keys Link, but I would to automate this process using another application.

I have found these API https://developer.ibm.com/iotfoundation/recipes/api-documentation, but the API Key is a prerequisite.

Thanks in advance Regards

1
Can you explain why you want to automate this process? It seems perfectly reasonable to not have this as an automatable process. You should only have to register for an API Key once, and then use that key in all instances of your application. - Lars Kristensen

1 Answers

1
votes

I've had the exact same problem when deploying a complex microservice architecture to Bluemix. Like you, I needed to generate API keys, that I could then use to register a device (without having to use the UI).

I solved it by using the following shell script to generate an API key.

# Create key to access service credentials
echo ""
echo "Now creating service keys for the IoT platform service ..."
cf create-service-key my-iotf-service mykey

# Accessing and storing credentials
cred=$(cf service-key my-iotf-service mykey)

Hope that helps