Generate API Key
To generate a new API key, use the following request:
POST /users/:id/user_api_keys/generate.xml
POST /users/:id/user_api_keys/generate.json
XML Request Example
curl -u 'user@email:user_api_key' --request POST 'http://onapp.test/users/2/user_api_keys/generate.xml'
JSON Request Example
curl -u 'user@email:user_api_key' --request POST 'http://onapp.test/users/2/user_api_keys/generate.json'
XML Output Example
<hash> <api_key>5d7dc3517045da821f3ee88c2199bb558e78ab09</api_key> </hash>
Where:
api_key - API key created for a user
We do not store the API keys for security reasons. This is the only time you can see the key.
There is a limit of 100 API keys per user. To increase the limit:
- Open file /onapp/interface/config/info_hub.yml
- Add parameter api.max_keys and set an appropriate value for API keys limit
- The user can create API keys using API only for other users.
- The API call to create a new API key works only upon authorization with an API key but not with a login and password.
- API keys generated for other users have the following description: Generated through API by <API key creator's user login>.