ApiKeysApi
All URIs are relative to http://localhost
Method | HTTP request | Description |
---|---|---|
createApiKey | POST /api_keys | Create new api key for current user |
deleteApiKey | DELETE /api_keys/{id} | Delete provided api key |
listApiKeys | GET /api_keys | Load api keys for user |
#
createApiKey/*** @returns DisplayApiKey**/async function createApiKey(body: CreateApiKeyBody, opts)
Create new api key for current user
#
Notes:Requires scope CreateApiKey
. When query param user_id
is provided requires admin role.
#
Exampleconst yat = require('yatjs');const api = new yat.YatJs();
await api.login("[email protected]", "your_password");
let body = new YatJs.CreateApiKeyBody(); // CreateApiKeyBody // populate body...
let opts = { 'userId': null // String | User id for which api key should be applied};try { let res = await api.apiKeys().createApiKey(body, opts); // res is of type DisplayApiKey console.log('API called successfully. Result: ', res);} catch (error) { console.error(error);}
#
ParametersName | Type | Description | Notes |
---|---|---|---|
body | CreateApiKeyBody | ||
userId | String | ||
User id for which api key should be applied | [optional] |
#
Return type#
Authorization#
HTTP request headers- Content-Type: Not defined
- Accept: /
#
deleteApiKey/*** @returns DisplayApiKey**/async function deleteApiKey(id: String)
Delete provided api key
#
Notes:When key does not belong to current user requires Admin access
#
Exampleconst yat = require('yatjs');const api = new yat.YatJs();
await api.login("[email protected]", "your_password");
let id = "id_example"; // String // populate id...
try { let res = await api.apiKeys().deleteApiKey(id); // res is of type DisplayApiKey console.log('API called successfully. Result: ', res);} catch (error) { console.error(error);}
#
ParametersName | Type | Description | Notes |
---|---|---|---|
id | String |
#
Return type#
Authorization#
HTTP request headers- Content-Type: Not defined
- Accept: /
#
listApiKeys/*** @returns [DisplayApiKey]**/async function listApiKeys(opts)
Load api keys for user
#
Notes:If query param user_id
is provided requires admin role.
#
Exampleconst yat = require('yatjs');const api = new yat.YatJs();
await api.login("[email protected]", "your_password");
let opts = { 'userId': null // String | User id for which api key should be applied};try { let res = await api.apiKeys().listApiKeys(opts); // res is of type [DisplayApiKey] console.log('API called successfully. Result: ', res);} catch (error) { console.error(error);}
#
ParametersName | Type | Description | Notes |
---|---|---|---|
userId | String | ||
User id for which api key should be applied | [optional] |
#
Return type#
Authorization#
HTTP request headers- Content-Type: Not defined
- Accept: /