ApiKey
balena.models.apiKey : object
Kind: static namespace
create
balena.models.apiKey.create(createApiKeyParams) ⇒ Promise
This method registers a new api key for the current user with the name given.
Kind: static method of apiKey
Summary: Creates a new user API key
Access: public
Fulfil: String - API key
createApiKeyParams
Object
an object containing the parameters for the creation of an API key
createApiKeyParams.name
String
the API key name
createApiKeyParams.expiryDate
String
the API key expiry date
[createApiKeyParams.description]
String
the API key description
Example
balena.models.apiKey.create({name: apiKeyName, expiryDate: 2030-10-12}).then(function(apiKey) {
console.log(apiKey);
});Example
balena.models.apiKey.create({name: apiKeyName, expiryDate: 2030-10-12, description: apiKeyDescription}).then(function(apiKey) {
console.log(apiKey);
});getAll
balena.models.apiKey.getAll([options]) ⇒ Promise
Kind: static method of apiKey
Summary: Get all accessible API keys
Access: public
Fulfil: Object[] - apiKeys
[options]
Object
{}
extra pine options to use
Example
getAllNamedUserApiKeys
balena.models.apiKey.getAllNamedUserApiKeys([options]) ⇒ Promise
Kind: static method of apiKey
Summary: Get all named user API keys of the current user
Access: public
Fulfil: Object[] - apiKeys
[options]
Object
{}
extra pine options to use
Example
getDeviceApiKeysByDevice
balena.models.apiKey.getDeviceApiKeysByDevice(uuidOrId, [options]) ⇒ Promise
Kind: static method of apiKey
Summary: Get all API keys for a device
Access: public
Fulfil: Object[] - apiKeys
uuidOrId
String | Number
device, uuid (string) or id (number)
[options]
Object
{}
extra pine options to use
Example
getProvisioningApiKeysByApplication
balena.models.apiKey.getProvisioningApiKeysByApplication(slugOrUuidOrId, [options]) ⇒ Promise
Kind: static method of apiKey
Summary: Get all provisioning API keys for an application
Access: public
Fulfil: Object[] - apiKeys
slugOrUuidOrId
String | Number
application slug (string), uuid (string) or id (number)
[options]
Object
{}
extra pine options to use
Example
revoke
balena.models.apiKey.revoke(id) ⇒ Promise
Kind: static method of apiKey
Summary: Revoke an API key
Access: public
id
Number
API key id
Example
update
balena.models.apiKey.update(id, apiKeyInfo) ⇒ Promise
Kind: static method of apiKey
Summary: Update the details of an API key
Access: public
id
Number
API key id
apiKeyInfo
Object
an object with the updated name|description|expiryDate
Example
Example
Example
Example
Last updated
Was this helpful?