Account API
The account API allows users to query and manipulate their own account data.
Get all tokens
| Path | Method | Protected |
|---|---|---|
/v1/accounts/{account_id}/tokens | GET | Yes |
Gets all created tokens of an account. The format of each element is the same as the data object in the oauth2 endpoint's response.
Example Response JSON
{
"values": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"accountId": "3d07c219-0a88-45be-9cfc-91e9d095a1e9",
"createdAt": "2019-08-24T14:15:22Z",
"expiresAt": "2019-08-24T14:15:22Z"
}
]
}Create new token
| Path | Method | Protected |
|---|---|---|
/v1/accounts/{account_id}/tokens | POST | Yes |
Creates a new token with a given expiration date. The response not only contains the token data but also the secret which can be passed as a bearer token to the Authorization header to the Golem Cloud REST API.
Example Request JSON
{
"expiresAt": "2019-08-24T14:15:22Z"
}Example Response JSON
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"secret": "stringstringstri",
"accountId": "3d07c219-0a88-45be-9cfc-91e9d095a1e9",
"createdAt": "2019-08-24T14:15:22Z",
"expiresAt": "2019-08-24T14:15:22Z"
}Create account
| Path | Method | Protected |
|---|---|---|
/v1/accounts | POST | Yes |
Create a new account. The response is the created account data.
Example Request JSON
{
"name": "string",
"email": "string"
}Example Response JSON
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"revision": 0,
"name": "string",
"email": "string",
"planId": "b3f60ba2-c1fd-4b3a-a23d-8e876e0ef75d",
"roles": [
"admin"
]
}Get account
| Path | Method | Protected |
|---|---|---|
/v1/accounts/{account_id} | GET | Yes |
Retrieve an account for a given Account ID
Example Response JSON
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"revision": 0,
"name": "string",
"email": "string",
"planId": "b3f60ba2-c1fd-4b3a-a23d-8e876e0ef75d",
"roles": [
"admin"
]
}Update account
| Path | Method | Protected |
|---|---|---|
/v1/accounts/{account_id} | PUT | Yes |
Allows the user to change the account details such as name and email.
Changing the planId is not allowed and the request will be rejected. The response is the updated account data.
Example Request JSON
{
"currentRevision": 0,
"name": "string",
"email": "string"
}Example Response JSON
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"revision": 0,
"name": "string",
"email": "string",
"planId": "b3f60ba2-c1fd-4b3a-a23d-8e876e0ef75d",
"roles": [
"admin"
]
}Delete account
| Path | Method | Protected |
|---|---|---|
/v1/accounts/{account_id} | DELETE | Yes |
Delete an account.
Query Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| current_revision | integer | Yes | - |
Example Response JSON
{}Get account's plan
| Path | Method | Protected |
|---|---|---|
/v1/accounts/{account_id}/plan | GET | Yes |
Example Response JSON
{
"planId": "b3f60ba2-c1fd-4b3a-a23d-8e876e0ef75d",
"name": "string",
"appLimit": 0,
"envLimit": 0,
"componentLimit": 0,
"workerLimit": 0,
"workerConnectionLimit": 0,
"storageLimit": 0,
"monthlyGasLimit": 0,
"monthlyUploadLimit": 0,
"maxMemoryPerWorker": 0
}Update plan of an accout
| Path | Method | Protected |
|---|---|---|
/v1/accounts/{account_id}/plan | PUT | Yes |
Example Request JSON
{
"currentRevision": 0,
"plan": "c685f150-7cb7-436f-9700-386be171480b"
}Example Response JSON
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"revision": 0,
"name": "string",
"email": "string",
"planId": "b3f60ba2-c1fd-4b3a-a23d-8e876e0ef75d",
"roles": [
"admin"
]
}Update roles of an accout
| Path | Method | Protected |
|---|---|---|
/v1/accounts/{account_id}/roles | PUT | Yes |
Example Request JSON
{
"currentRevision": 0,
"roles": [
"admin"
]
}Example Response JSON
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"revision": 0,
"name": "string",
"email": "string",
"planId": "b3f60ba2-c1fd-4b3a-a23d-8e876e0ef75d",
"roles": [
"admin"
]
}Get all plugins registered in account
| Path | Method | Protected |
|---|---|---|
/v1/accounts/{account_id}/plugins | GET | Yes |
Example Response JSON
{
"values": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"accountId": "3d07c219-0a88-45be-9cfc-91e9d095a1e9",
"name": "string",
"version": "string",
"description": "string",
"icon": "string",
"homepage": "string",
"spec": {
"type": "ComponentTransformer",
"providedWitPackage": "string",
"jsonSchema": null,
"validateUrl": "string",
"transformUrl": "string"
}
}
]
}Register a new plugin
| Path | Method | Protected |
|---|---|---|
/v1/accounts/{account_id}/plugins | POST | Yes |
Request Form: multipart/form-data
Make sure to include
Content-Type: multipart/form-dataHeader
Field metadata: JSON
{
"name": "string",
"version": "string",
"description": "string",
"icon": "string",
"homepage": "string",
"spec": {
"type": "ComponentTransformer",
"providedWitPackage": "string",
"jsonSchema": null,
"validateUrl": "string",
"transformUrl": "string"
}
}Field pluginWasm: string binary
Example Response JSON
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"accountId": "3d07c219-0a88-45be-9cfc-91e9d095a1e9",
"name": "string",
"version": "string",
"description": "string",
"icon": "string",
"homepage": "string",
"spec": {
"type": "ComponentTransformer",
"providedWitPackage": "string",
"jsonSchema": null,
"validateUrl": "string",
"transformUrl": "string"
}
}Account API Errors
| Status Code | Description | Body |
|---|---|---|
| 400 | Invalid request, returning with a list of issues detected in the request | {"errors":["string"]} |
| 401 | Unauthorized request | {"error":"string"} |
| 403 | Forbidden Request | {"error":"string"} |
| 404 | Entity not found | {"error":"string"} |
| 409 | {"error":"string"} | |
| 422 | Limits of the plan exceeded | {"error":"string"} |
| 500 | Internal server error | {"error":"string"} |