Authentication
Authentication is the entry point into the API.
The login
method is used to retrieve an authentication key (auth-key) through a user ID and password. This key is then valid and can be used for the whole duration of the user session and is used to identify the user during subsequent API calls.
You can also create permanent API keys in user settings.
Use
For HTTP calls, the key is passed in the X-BM-ApiKey
header.
For Java calls, the key is used to create a service-provider to create API instances. For example:
IServiceProvider serviceProvider = ClientSideServiceProvider.getProvider(server, resp.authKey);
HTTP example
Method | URL |
---|---|
POST | https://"domain"/api/auth/login?login="login" |
login = user ID | |
Body | |
'"password"' |
Curl example
curl -X POST -k --header 'Content-Type: application/json' --header 'Accept: application/json' -d '"<password>"' 'https://<domain>/api/auth/login?login=<login>'
Java example (using the BlueMind generated client)
String serverUrl = "https://<domain>";
LoginResponse resp = ClientSideServiceProvider.getProvider(serverUrl, null).instance(IAuthentication.class).login(<login>, <password>, "");
IServiceProvider serviceProvider = ClientSideServiceProvider.getProvider(server, resp.authKey);