2020-04-28 18:06:59 +01:00
|
|
|
# satellite/admin
|
|
|
|
|
|
|
|
Satellite Admin package provides API endpoints for administrative tasks.
|
|
|
|
|
|
|
|
Requires setting `Authorization` header for requests.
|
|
|
|
|
2021-05-06 18:46:14 +01:00
|
|
|
<!-- Auto-generate this ToC with https://github.com/ycd/toc -->
|
2021-05-06 06:22:14 +01:00
|
|
|
<!-- toc -->
|
|
|
|
- [satellite/admin](#satelliteadmin)
|
2021-10-01 12:36:41 +01:00
|
|
|
* [API design](#api-design)
|
2021-12-01 15:33:41 +00:00
|
|
|
* [Successful responses](#successful-responses)
|
2021-10-01 12:36:41 +01:00
|
|
|
* [Error responses](#error-responses)
|
|
|
|
* [API Endpoints](#api-endpoints)
|
|
|
|
* [User Management](#user-management)
|
|
|
|
* [POST /api/users](#post-apiusers)
|
|
|
|
* [PUT /api/users/{user-email}](#put-apiusersuser-email)
|
|
|
|
* [GET /api/users/{user-email}](#get-apiusersuser-email)
|
|
|
|
* [DELETE /api/users/{user-email}](#delete-apiusersuser-email)
|
|
|
|
* [Project Management](#project-management)
|
|
|
|
* [POST /api/projects](#post-apiprojects)
|
|
|
|
* [GET /api/projects/{project-id}](#get-apiprojectsproject-id)
|
|
|
|
* [PUT /api/projects/{project-id}](#put-apiprojectsproject-id)
|
|
|
|
* [DELETE /api/projects/{project-id}](#delete-apiprojectsproject-id)
|
|
|
|
* [GET /api/projects/{project}/apikeys](#get-apiprojectsprojectapikeys)
|
|
|
|
* [POST /api/projects/{project}/apikeys](#post-apiprojectsprojectapikeys)
|
|
|
|
* [DELETE /api/projects/{project}/apikeys/{name}](#delete-apiprojectsprojectapikeysname)
|
|
|
|
* [GET /api/projects/{project-id}/usage](#get-apiprojectsproject-idusage)
|
|
|
|
* [GET /api/projects/{project-id}/limit](#get-apiprojectsproject-idlimit)
|
|
|
|
* [Update limits](#update-limits)
|
|
|
|
* [POST /api/projects/{project-id}/limit?usage={value}](#post-apiprojectsproject-idlimitusagevalue)
|
|
|
|
* [POST /api/projects/{project-id}/limit?bandwidth={value}](#post-apiprojectsproject-idlimitbandwidthvalue)
|
|
|
|
* [POST /api/projects/{project-id}/limit?rate={value}](#post-apiprojectsproject-idlimitratevalue)
|
|
|
|
* [POST /api/projects/{project-id}/limit?buckets={value}](#post-apiprojectsproject-idlimitbucketsvalue)
|
2022-04-20 12:46:47 +01:00
|
|
|
* [POST /api/projects/{project-id}/limit?segments={value}](#post-apiprojectsproject-idlimitsegmentsvalue)
|
2021-11-12 20:48:29 +00:00
|
|
|
* [Bucket Management](#bucket-management)
|
2021-11-30 17:47:14 +00:00
|
|
|
* [GET /api/projects/{project-id}/buckets/{bucket-name}](#get-apiprojectsproject-idbucketsbucket-name)
|
2021-11-12 20:48:29 +00:00
|
|
|
* [Geofencing](#geofencing)
|
|
|
|
* [POST /api/projects/{project-id}/buckets/{bucket-name}/geofence?region={value}](#post-apiprojectsproject-idbucketsbucket-namegeofenceregionvalue)
|
|
|
|
* [DELETE /api/projects/{project-id}/buckets/{bucket-name}/geofence](#delete-apiprojectsproject-idbucketsbucket-namegeofence)
|
2021-10-01 12:36:41 +01:00
|
|
|
* [APIKey Management](#apikey-management)
|
|
|
|
* [DELETE /api/apikeys/{apikey}](#delete-apiapikeysapikey)
|
2021-05-06 06:22:14 +01:00
|
|
|
|
|
|
|
<!-- tocstop -->
|
|
|
|
|
2021-10-01 12:36:41 +01:00
|
|
|
## API design
|
2020-10-20 00:35:54 +01:00
|
|
|
|
2021-12-01 15:33:41 +00:00
|
|
|
### Successful responses
|
|
|
|
|
|
|
|
For non-get requests (`PUT`, `POST`, `DELETE`), endpoints should return an empty response body on success. `GET`
|
|
|
|
requests can return a non-empty body for the resource that we're interacting with.
|
|
|
|
|
2021-10-01 12:36:41 +01:00
|
|
|
### Error responses
|
|
|
|
|
|
|
|
When an API endpoint returns a client error (status code 4XX) it returns a JSON error response which contains 2 fields:
|
|
|
|
|
|
|
|
* `error`: The error message.
|
|
|
|
* `detail` (may be empty): Some detail about the returned error.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"error": "usage for the current month exists",
|
|
|
|
"detail": ""
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## API Endpoints
|
|
|
|
### User Management
|
|
|
|
|
|
|
|
#### POST /api/users
|
2020-05-18 21:37:18 +01:00
|
|
|
|
|
|
|
Adds a new user.
|
|
|
|
|
2020-06-13 17:33:08 +01:00
|
|
|
An example of a required request body:
|
2020-05-18 21:37:18 +01:00
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"email": "alice@mail.test",
|
|
|
|
"fullName": "Alice Test",
|
|
|
|
"password": "password"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2020-06-13 17:33:08 +01:00
|
|
|
A successful response body:
|
2020-05-18 21:37:18 +01:00
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"id": "12345678-1234-1234-1234-123456789abc",
|
|
|
|
"email": "alice@mail.test",
|
|
|
|
"fullName": "Alice Test",
|
|
|
|
"shortName": "",
|
|
|
|
"passwordHash": ""
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2021-10-01 12:36:41 +01:00
|
|
|
#### PUT /api/users/{user-email}
|
2020-05-20 10:20:04 +01:00
|
|
|
|
|
|
|
Updates the details of existing user found by its email.
|
|
|
|
|
2020-10-02 23:40:15 +01:00
|
|
|
Some example request bodies:
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"email": "alice+2@mail.test"
|
|
|
|
}
|
|
|
|
```
|
2020-05-20 10:20:04 +01:00
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"email": "alice+2@mail.test",
|
2020-10-02 23:40:15 +01:00
|
|
|
"shortName": "myNickName"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"projectLimit": 200
|
2020-05-20 10:20:04 +01:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2021-10-01 12:36:41 +01:00
|
|
|
#### GET /api/users/{user-email}
|
2020-04-28 18:06:59 +01:00
|
|
|
|
|
|
|
This endpoint returns information about user and their projects.
|
|
|
|
|
2020-06-13 17:33:08 +01:00
|
|
|
A successful response body:
|
2020-04-28 18:06:59 +01:00
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"user":{
|
|
|
|
"id": "12345678-1234-1234-1234-123456789abc",
|
|
|
|
"fullName": "Alice Bob",
|
2020-10-02 23:40:15 +01:00
|
|
|
"email":"alice@example.test",
|
|
|
|
"projectLimit": 10
|
2020-04-28 18:06:59 +01:00
|
|
|
},
|
|
|
|
"projects":[
|
|
|
|
{
|
|
|
|
"id": "abcabcab-1234-abcd-abcd-abecdefedcab",
|
|
|
|
"name": "Project",
|
|
|
|
"description": "Project to store data.",
|
|
|
|
"ownerId": "12345678-1234-1234-1234-123456789abc"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2021-10-01 12:36:41 +01:00
|
|
|
#### DELETE /api/users/{user-email}
|
2020-07-06 22:31:40 +01:00
|
|
|
|
|
|
|
Deletes the user.
|
|
|
|
|
2022-01-11 18:42:17 +00:00
|
|
|
### OAuth Client Management
|
|
|
|
|
|
|
|
Manages oauth clients known to the Satellite.
|
|
|
|
|
|
|
|
#### POST /api/oauth/clients
|
|
|
|
|
|
|
|
Create a new OAuthClient. A client ID and clientSecret will be returned upon creation.
|
|
|
|
|
|
|
|
Example request:
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"id": "uuid-of-the-client",
|
|
|
|
"secret": "shh-this-should-be-kept-safe",
|
|
|
|
"redirectURL": "http://localhost:8888/oauth/storj/callback",
|
|
|
|
"userID": "uuid-of-the-owner",
|
|
|
|
"appName": "Example App",
|
|
|
|
"appLogoURL": "http://localhost:8888/logo.png"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
#### PUT /api/oauth/clients/{id}
|
|
|
|
|
|
|
|
Update an existing oauth client.
|
|
|
|
|
|
|
|
Example request:
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"redirectURL": "http://localhost:8888/oauth/storj/callback",
|
|
|
|
"appName": "Example App",
|
|
|
|
"appLogoURL": "http://localhost:8888/logo.png"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
#### DELETE /api/oauth/clients/{id}
|
|
|
|
|
|
|
|
Delete the identified oauth client.
|
|
|
|
|
2021-10-01 12:36:41 +01:00
|
|
|
### Project Management
|
2020-10-20 00:35:54 +01:00
|
|
|
|
2021-10-01 12:36:41 +01:00
|
|
|
#### POST /api/projects
|
2020-10-20 00:35:54 +01:00
|
|
|
|
|
|
|
Adds a project for specific user.
|
|
|
|
|
|
|
|
An example of a required request body:
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"ownerId": "ca7aa0fb-442a-4d4e-aa36-a49abddae837",
|
|
|
|
"projectName": "My Second Project"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
A successful response body:
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"projectId": "ca7aa0fb-442a-4d4e-aa36-a49abddae646"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2021-10-01 12:36:41 +01:00
|
|
|
#### GET /api/projects/{project-id}
|
2020-09-05 20:17:18 +01:00
|
|
|
|
|
|
|
Gets the common information about a project.
|
|
|
|
|
2021-10-01 12:36:41 +01:00
|
|
|
#### PUT /api/projects/{project-id}
|
2020-07-06 21:28:49 +01:00
|
|
|
|
|
|
|
Updates project name or description.
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"projectName": "My new Project Name",
|
|
|
|
"description": "My new awesome description!"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2021-10-01 12:36:41 +01:00
|
|
|
#### DELETE /api/projects/{project-id}
|
2020-05-18 18:36:09 +01:00
|
|
|
|
|
|
|
Deletes the project.
|
|
|
|
|
2021-10-01 12:36:41 +01:00
|
|
|
#### GET /api/projects/{project}/apikeys
|
2021-07-30 19:06:36 +01:00
|
|
|
|
|
|
|
Get the list of the API keys of a specific project.
|
|
|
|
|
|
|
|
A successful response body:
|
|
|
|
|
|
|
|
```json
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"id": "b6988bd2-8d21-4bee-91ac-a3445bf38180",
|
|
|
|
"ownerId": "ca7aa0fb-442a-4d4e-aa36-a49abddae837",
|
|
|
|
"name": "mine",
|
|
|
|
"partnerID": "a9d3b7ee-17da-4848-bb0e-1f64cf45af18",
|
|
|
|
"createdAt": "2020-05-19T00:34:13.265761+02:00"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "f9f887c1-b178-4eb8-b669-14379c5a97ca",
|
|
|
|
"ownerId": "3eb45ae9-822a-470e-a51a-9144dedda63e",
|
|
|
|
"name": "family",
|
|
|
|
"partnerID": "",
|
|
|
|
"createdAt": "2020-02-20T15:34:24.265761+02:00"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
```
|
|
|
|
|
2021-10-01 12:36:41 +01:00
|
|
|
#### POST /api/projects/{project}/apikeys
|
2020-05-11 17:05:36 +01:00
|
|
|
|
2020-10-20 00:35:54 +01:00
|
|
|
Adds an apikey for specific project.
|
2020-05-11 17:05:36 +01:00
|
|
|
|
2020-06-13 17:33:08 +01:00
|
|
|
An example of a required request body:
|
2020-05-11 17:05:36 +01:00
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
2020-10-20 00:35:54 +01:00
|
|
|
"name": "My first API Key"
|
2020-05-11 17:05:36 +01:00
|
|
|
}
|
|
|
|
```
|
2020-10-20 00:35:54 +01:00
|
|
|
**Note:** Additionally you can specify `partnerId` to associate it with the given apikey.
|
|
|
|
If you specify it, it has to be a valid uuid and not an empty string.
|
2020-05-11 17:05:36 +01:00
|
|
|
|
2020-06-13 17:33:08 +01:00
|
|
|
A successful response body:
|
2020-05-11 17:05:36 +01:00
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
2020-10-20 00:35:54 +01:00
|
|
|
"apikey": "13YqdMKxAVBamFsS6Mj3sCQ35HySoA254xmXCCQGJqffLnqrBaQDoTcCiCfbkaFPNewHT79rrFC5XRm4Z2PENtRSBDVNz8zcjS28W5v"
|
2020-05-11 17:05:36 +01:00
|
|
|
}
|
2020-05-14 13:50:58 +01:00
|
|
|
```
|
2020-10-20 00:35:54 +01:00
|
|
|
|
2021-10-01 12:36:41 +01:00
|
|
|
#### DELETE /api/projects/{project}/apikeys/{name}
|
2020-10-20 00:35:54 +01:00
|
|
|
|
|
|
|
Deletes the given apikey by its name.
|
|
|
|
|
2021-10-01 12:36:41 +01:00
|
|
|
#### GET /api/projects/{project-id}/usage
|
2021-05-05 19:41:16 +01:00
|
|
|
|
|
|
|
This endpoint returns whether the project has outstanding usage or not.
|
|
|
|
|
|
|
|
A project with not usage returns status code 200 and `{"result":"no project usage exist"}`.
|
2021-10-01 12:36:41 +01:00
|
|
|
Otherwise, it returns status code 409 with a JSON error.`{"error":"usage for current month exists""}`.
|
2021-05-05 19:41:16 +01:00
|
|
|
|
2021-10-01 12:36:41 +01:00
|
|
|
#### GET /api/projects/{project-id}/limit
|
2021-05-05 19:41:16 +01:00
|
|
|
|
|
|
|
This endpoint returns information about project limits.
|
|
|
|
|
|
|
|
A successful response body:
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"usage": {
|
|
|
|
"amount": "1.0 TB",
|
|
|
|
"bytes": 1000000000000
|
|
|
|
},
|
|
|
|
"bandwidth": {
|
|
|
|
"amount": "1.0 TB",
|
|
|
|
"bytes": 1000000000000
|
|
|
|
},
|
|
|
|
"rate": {
|
|
|
|
"rps": 0
|
2021-12-22 10:58:37 +00:00
|
|
|
},
|
|
|
|
"maxBuckets": 1000,
|
|
|
|
"maxSegments": 1000000000
|
2021-05-05 19:41:16 +01:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2021-10-01 12:36:41 +01:00
|
|
|
#### Update limits
|
2021-05-05 19:41:16 +01:00
|
|
|
|
|
|
|
You can update the different limits with one single request just adding the
|
|
|
|
various query parameters (e.g. `usage=5000000&bandwidth=9000000`)
|
|
|
|
|
2021-10-01 12:36:41 +01:00
|
|
|
##### POST /api/projects/{project-id}/limit?usage={value}
|
2021-05-05 19:41:16 +01:00
|
|
|
|
|
|
|
Updates usage limit for a project. The value must be in bytes.
|
|
|
|
|
2021-10-01 12:36:41 +01:00
|
|
|
##### POST /api/projects/{project-id}/limit?bandwidth={value}
|
2021-05-05 19:41:16 +01:00
|
|
|
|
|
|
|
Updates bandwidth limit for a project. The value must be in bytes.
|
|
|
|
|
2021-10-01 12:36:41 +01:00
|
|
|
##### POST /api/projects/{project-id}/limit?rate={value}
|
2021-05-05 19:41:16 +01:00
|
|
|
|
|
|
|
Updates rate limit for a project.
|
|
|
|
|
2021-10-01 12:36:41 +01:00
|
|
|
##### POST /api/projects/{project-id}/limit?buckets={value}
|
2021-05-05 19:41:16 +01:00
|
|
|
|
2021-12-22 10:58:37 +00:00
|
|
|
Updates number of buckets limit for a project.
|
|
|
|
|
|
|
|
##### POST /api/projects/{project-id}/limit?burst={value}
|
|
|
|
|
|
|
|
Updates burst limit for a project.
|
|
|
|
|
|
|
|
##### POST /api/projects/{project-id}/limit?segments={value}
|
|
|
|
|
|
|
|
Updates number of segments limit for a project.
|
2021-05-05 19:41:16 +01:00
|
|
|
|
2021-11-12 20:48:29 +00:00
|
|
|
### Bucket Management
|
|
|
|
|
|
|
|
This set of APIs provide administrative functionality over bucket functionality.
|
|
|
|
|
2021-11-30 17:47:14 +00:00
|
|
|
#### GET /api/projects/{project-id}/buckets/{bucket-name}
|
|
|
|
|
|
|
|
Returns all the information of the specified bucket.
|
|
|
|
|
2021-11-12 20:48:29 +00:00
|
|
|
#### Geofencing
|
|
|
|
|
|
|
|
Manage geofencing capabilities for a given bucket.
|
|
|
|
|
|
|
|
##### POST /api/projects/{project-id}/buckets/{bucket-name}/geofence?region={value}
|
|
|
|
|
|
|
|
Enables the geofencing configuration for the specified bucket. The bucket MUST be empty in order for this to work. Valid
|
|
|
|
values for the `region` parameter are:
|
|
|
|
|
|
|
|
- `EU` - restrict placement to data nodes that reside in the [European Union][]
|
|
|
|
- `EEA` - restrict placement to data nodes that reside in the [European Economic Area][]
|
|
|
|
- `US` - restricts placement to data nodes in the United States
|
|
|
|
- `DE` - restricts placement to data nodes in Germany
|
|
|
|
|
|
|
|
[European Union]: https://github.com/storj/common/blob/main/storj/location/region.go#L14
|
|
|
|
|
|
|
|
[European Economic Area]: https://github.com/storj/common/blob/main/storj/location/region.go#L7
|
|
|
|
|
|
|
|
##### DELETE /api/projects/{project-id}/buckets/{bucket-name}/geofence
|
|
|
|
|
|
|
|
Removes the geofencing configuration for the specified bucket. The bucket MUST be empty in order for this to work.
|
|
|
|
|
2021-10-01 12:36:41 +01:00
|
|
|
### APIKey Management
|
2020-10-20 00:35:54 +01:00
|
|
|
|
2021-10-01 12:36:41 +01:00
|
|
|
#### DELETE /api/apikeys/{apikey}
|
2020-10-20 00:35:54 +01:00
|
|
|
|
2021-05-05 19:41:16 +01:00
|
|
|
Deletes the given apikey.
|