flexmeasures.api.v3_0.accounts
Classes
- class flexmeasures.api.v3_0.accounts.AccountAPI
- auditlog(id: int, account: Account)
API endpoint to get history of account actions. Example response
- Reqheader Authorization:
The authentication token
- Reqheader Content-Type:
application/json
- Resheader Content-Type:
application/json
- Status 200:
PROCESSED
- Status 400:
INVALID_REQUEST, REQUIRED_INFO_MISSING, UNEXPECTED_PARAMS
- Status 401:
UNAUTHORIZED
- Status 403:
INVALID_SENDER
- Status 422:
UNPROCESSABLE_ENTITY
- get(id: int, account: Account)
API endpoint to get an account.
This endpoint retrieves an account, given its id. Only admins, consultants and users belonging to the account itself can use this endpoint.
Example response
{ 'id': 1, 'name': 'Test Account' 'account_roles': [1, 3], 'consultancy_account_id': 2, }
- Reqheader Authorization:
The authentication token
- Reqheader Content-Type:
application/json
- Resheader Content-Type:
application/json
- Status 200:
PROCESSED
- Status 400:
INVALID_REQUEST, REQUIRED_INFO_MISSING, UNEXPECTED_PARAMS
- Status 401:
UNAUTHORIZED
- Status 403:
INVALID_SENDER
- Status 422:
UNPROCESSABLE_ENTITY
- index()
API endpoint to list all accounts accessible to the current user.
This endpoint returns all accessible accounts. Accessible accounts are your own account and accounts you are a consultant for, or all accounts for admins.
Example response
An example of one account being returned:
[ { 'id': 1, 'name': 'Test Account' 'account_roles': [1, 3], 'consultancy_account_id': 2, } ]
- Reqheader Authorization:
The authentication token
- Reqheader Content-Type:
application/json
- Resheader Content-Type:
application/json
- Status 200:
PROCESSED
- Status 400:
INVALID_REQUEST
- Status 401:
UNAUTHORIZED
- Status 403:
INVALID_SENDER
- Status 422:
UNPROCESSABLE_ENTITY
- patch(account_data: dict, id: int, account: Account)
Update an account given its identifier.
This endpoint sets data for an existing account.
The following fields are not allowed to be updated: - id
The following fields are only editable if user role is admin: - consultancy_account_id
Example request
{ 'name': 'Test Account' 'primary_color': '#1a3443' 'secondary_color': '#f1a122' 'logo_url': 'https://example.com/logo.png' 'consultancy_account_id': 2, }
Example response
The whole account is returned in the response:
{ 'id': 1, 'name': 'Test Account' 'account_roles': [1, 3], 'primary_color': '#1a3443' 'secondary_color': '#f1a122' 'logo_url': 'https://example.com/logo.png' 'consultancy_account_id': 2, }
- Reqheader Authorization:
The authentication token
- Reqheader Content-Type:
application/json
- Resheader Content-Type:
application/json
- Status 200:
UPDATED
- Status 400:
INVALID_REQUEST, REQUIRED_INFO_MISSING, UNEXPECTED_PARAMS
- Status 401:
UNAUTHORIZED
- Status 403:
INVALID_SENDER
- Status 422:
UNPROCESSABLE_ENTITY