2016-11-24 03:16:24 -06:00
|
|
|
+++
|
2018-11-28 13:33:41 -06:00
|
|
|
title = "Organization HTTP API "
|
|
|
|
description = "Grafana Organization HTTP API"
|
|
|
|
keywords = ["grafana", "http", "documentation", "api", "organization"]
|
2019-12-30 01:17:03 -06:00
|
|
|
aliases = ["/docs/grafana/latest/http_api/organization/"]
|
2016-11-24 03:16:24 -06:00
|
|
|
type = "docs"
|
|
|
|
[menu.docs]
|
2018-11-28 13:33:41 -06:00
|
|
|
name = "Organization"
|
2016-11-24 03:16:24 -06:00
|
|
|
parent = "http_api"
|
|
|
|
+++
|
|
|
|
|
2016-02-03 00:59:22 -06:00
|
|
|
|
2018-11-28 13:33:41 -06:00
|
|
|
# Organization API
|
2016-02-03 00:59:22 -06:00
|
|
|
|
2018-11-28 13:33:41 -06:00
|
|
|
The Organization HTTP API is divided in two resources, `/api/org` (current organization)
|
|
|
|
and `/api/orgs` (admin organizations). One big difference between these are that
|
|
|
|
the admin of all organizations API only works with basic authentication, see [Admin Organizations API](#admin-organizations-api) for more information.
|
2018-06-29 12:08:38 -05:00
|
|
|
|
2018-11-28 13:33:41 -06:00
|
|
|
## Current Organization API
|
2018-06-29 12:08:38 -05:00
|
|
|
|
2018-11-28 13:33:41 -06:00
|
|
|
### Get current Organization
|
2016-02-03 00:59:22 -06:00
|
|
|
|
2017-10-25 01:15:51 -05:00
|
|
|
`GET /api/org/`
|
2016-02-03 00:59:22 -06:00
|
|
|
|
|
|
|
**Example Request**:
|
|
|
|
|
2017-10-05 12:01:03 -05:00
|
|
|
```http
|
2017-10-25 01:15:51 -05:00
|
|
|
GET /api/org/ HTTP/1.1
|
2017-10-05 12:01:03 -05:00
|
|
|
Accept: application/json
|
|
|
|
Content-Type: application/json
|
|
|
|
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
|
|
|
```
|
2016-02-03 00:59:22 -06:00
|
|
|
|
|
|
|
**Example Response**:
|
|
|
|
|
2017-10-05 12:01:03 -05:00
|
|
|
```http
|
|
|
|
HTTP/1.1 200
|
|
|
|
Content-Type: application/json
|
2016-02-03 00:59:22 -06:00
|
|
|
|
2017-10-05 12:01:03 -05:00
|
|
|
{
|
|
|
|
"id":1,
|
|
|
|
"name":"Main Org."
|
|
|
|
}
|
|
|
|
```
|
2016-02-03 00:59:22 -06:00
|
|
|
|
2018-11-28 13:33:41 -06:00
|
|
|
### Get all users within the current organization
|
2016-02-03 00:59:22 -06:00
|
|
|
|
2018-06-29 12:08:38 -05:00
|
|
|
`GET /api/org/users`
|
2016-02-03 00:59:22 -06:00
|
|
|
|
2019-08-12 13:03:48 -05:00
|
|
|
Returns all org users within the current organization.
|
|
|
|
Accessible to users with org admin role.
|
|
|
|
|
2016-02-03 00:59:22 -06:00
|
|
|
**Example Request**:
|
|
|
|
|
2017-10-05 12:01:03 -05:00
|
|
|
```http
|
2018-06-29 12:08:38 -05:00
|
|
|
GET /api/org/users HTTP/1.1
|
2017-10-05 12:01:03 -05:00
|
|
|
Accept: application/json
|
|
|
|
Content-Type: application/json
|
|
|
|
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
|
|
|
```
|
2016-02-03 00:59:22 -06:00
|
|
|
|
|
|
|
**Example Response**:
|
|
|
|
|
2017-10-05 12:01:03 -05:00
|
|
|
```http
|
|
|
|
HTTP/1.1 200
|
|
|
|
Content-Type: application/json
|
|
|
|
|
2018-06-29 12:08:38 -05:00
|
|
|
[
|
|
|
|
{
|
2019-08-12 13:03:48 -05:00
|
|
|
"orgId": 1,
|
|
|
|
"userId": 1,
|
|
|
|
"email": "admin@localhost",
|
|
|
|
"avatarUrl": "/avatar/46d229b033af06a191ff2267bca9ae56",
|
|
|
|
"login": "admin",
|
|
|
|
"role": "Admin",
|
|
|
|
"lastSeenAt": "2019-08-09T11:02:49+02:00",
|
|
|
|
"lastSeenAtAge": "< 1m"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
```
|
|
|
|
|
|
|
|
### Get all users within the current organization (lookup)
|
|
|
|
|
|
|
|
`GET /api/org/users/lookup`
|
|
|
|
|
|
|
|
Returns all org users within the current organization, but with less detailed information.
|
|
|
|
Accessible to users with org admin role, admin in any folder or admin of any team.
|
|
|
|
Mainly used by Grafana UI for providing list of users when adding team members and
|
|
|
|
when editing folder/dashboard permissions.
|
|
|
|
|
|
|
|
**Example Request**:
|
|
|
|
|
|
|
|
```http
|
|
|
|
GET /api/org/users/lookup HTTP/1.1
|
|
|
|
Accept: application/json
|
|
|
|
Content-Type: application/json
|
|
|
|
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
|
|
|
```
|
|
|
|
|
|
|
|
**Example Response**:
|
|
|
|
|
|
|
|
```http
|
|
|
|
HTTP/1.1 200
|
|
|
|
Content-Type: application/json
|
|
|
|
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"userId": 1,
|
|
|
|
"login": "admin",
|
|
|
|
"avatarUrl": "/avatar/46d229b033af06a191ff2267bca9ae56"
|
2017-10-05 12:01:03 -05:00
|
|
|
}
|
2018-06-29 12:08:38 -05:00
|
|
|
]
|
2017-10-05 12:01:03 -05:00
|
|
|
```
|
2016-02-03 00:59:22 -06:00
|
|
|
|
2018-06-29 12:08:38 -05:00
|
|
|
### Updates the given user
|
|
|
|
|
|
|
|
`PATCH /api/org/users/:userId`
|
2016-02-03 00:59:22 -06:00
|
|
|
|
|
|
|
**Example Request**:
|
|
|
|
|
2017-10-05 12:01:03 -05:00
|
|
|
```http
|
2018-06-29 12:08:38 -05:00
|
|
|
PATCH /api/org/users/1 HTTP/1.1
|
2017-10-05 12:01:03 -05:00
|
|
|
Accept: application/json
|
|
|
|
Content-Type: application/json
|
|
|
|
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
2018-06-29 12:08:38 -05:00
|
|
|
|
|
|
|
{
|
|
|
|
"role": "Viewer",
|
|
|
|
}
|
2017-10-05 12:01:03 -05:00
|
|
|
```
|
2016-02-03 00:59:22 -06:00
|
|
|
|
|
|
|
**Example Response**:
|
|
|
|
|
2017-10-05 12:01:03 -05:00
|
|
|
```http
|
|
|
|
HTTP/1.1 200
|
|
|
|
Content-Type: application/json
|
|
|
|
|
2018-06-29 12:08:38 -05:00
|
|
|
{"message":"Organization user updated"}
|
2017-10-05 12:01:03 -05:00
|
|
|
```
|
2016-02-03 00:59:22 -06:00
|
|
|
|
2018-11-28 13:33:41 -06:00
|
|
|
### Delete user in current organization
|
2016-11-16 02:06:05 -06:00
|
|
|
|
2018-06-29 12:08:38 -05:00
|
|
|
`DELETE /api/org/users/:userId`
|
2016-11-16 02:06:05 -06:00
|
|
|
|
|
|
|
**Example Request**:
|
|
|
|
|
2017-10-05 12:01:03 -05:00
|
|
|
```http
|
2018-06-29 12:08:38 -05:00
|
|
|
DELETE /api/org/users/1 HTTP/1.1
|
2017-10-05 12:01:03 -05:00
|
|
|
Accept: application/json
|
|
|
|
Content-Type: application/json
|
|
|
|
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
|
|
|
```
|
2016-11-16 02:06:05 -06:00
|
|
|
|
|
|
|
**Example Response**:
|
|
|
|
|
2017-10-05 12:01:03 -05:00
|
|
|
```http
|
|
|
|
HTTP/1.1 200
|
|
|
|
Content-Type: application/json
|
2016-11-16 02:06:05 -06:00
|
|
|
|
2018-06-29 12:08:38 -05:00
|
|
|
{"message":"User removed from organization"}
|
2017-10-05 12:01:03 -05:00
|
|
|
```
|
2016-11-16 02:06:05 -06:00
|
|
|
|
2018-11-28 13:33:41 -06:00
|
|
|
### Update current Organization
|
2016-02-03 00:59:22 -06:00
|
|
|
|
|
|
|
`PUT /api/org`
|
|
|
|
|
|
|
|
**Example Request**:
|
|
|
|
|
2017-10-05 12:01:03 -05:00
|
|
|
```http
|
|
|
|
PUT /api/org HTTP/1.1
|
|
|
|
Accept: application/json
|
|
|
|
Content-Type: application/json
|
|
|
|
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
2016-02-03 00:59:22 -06:00
|
|
|
|
2017-10-05 12:01:03 -05:00
|
|
|
{
|
|
|
|
"name":"Main Org."
|
|
|
|
}
|
|
|
|
```
|
2016-02-03 00:59:22 -06:00
|
|
|
|
|
|
|
**Example Response**:
|
|
|
|
|
2017-10-05 12:01:03 -05:00
|
|
|
```http
|
|
|
|
HTTP/1.1 200
|
|
|
|
Content-Type: application/json
|
2016-02-03 00:59:22 -06:00
|
|
|
|
2017-10-05 12:01:03 -05:00
|
|
|
{"message":"Organization updated"}
|
|
|
|
```
|
2016-02-03 00:59:22 -06:00
|
|
|
|
2018-11-28 13:33:41 -06:00
|
|
|
### Add a new user to the current organization
|
2016-02-03 00:59:22 -06:00
|
|
|
|
2018-06-29 12:08:38 -05:00
|
|
|
`POST /api/org/users`
|
|
|
|
|
2018-11-28 13:33:41 -06:00
|
|
|
Adds a global user to the current organization.
|
2016-02-03 00:59:22 -06:00
|
|
|
|
|
|
|
**Example Request**:
|
|
|
|
|
2017-10-05 12:01:03 -05:00
|
|
|
```http
|
2018-06-29 12:08:38 -05:00
|
|
|
POST /api/org/users HTTP/1.1
|
2017-10-05 12:01:03 -05:00
|
|
|
Accept: application/json
|
|
|
|
Content-Type: application/json
|
|
|
|
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
2018-06-29 12:08:38 -05:00
|
|
|
|
|
|
|
{
|
|
|
|
"role": "Admin",
|
|
|
|
"loginOrEmail": "admin"
|
|
|
|
}
|
2017-10-05 12:01:03 -05:00
|
|
|
```
|
2016-02-03 00:59:22 -06:00
|
|
|
|
|
|
|
**Example Response**:
|
|
|
|
|
2017-10-05 12:01:03 -05:00
|
|
|
```http
|
|
|
|
HTTP/1.1 200
|
|
|
|
Content-Type: application/json
|
|
|
|
|
2018-06-29 12:08:38 -05:00
|
|
|
{"message":"User added to organization"}
|
2017-10-05 12:01:03 -05:00
|
|
|
```
|
2016-02-03 00:59:22 -06:00
|
|
|
|
2018-11-28 13:33:41 -06:00
|
|
|
## Admin Organizations API
|
2016-02-03 00:59:22 -06:00
|
|
|
|
2018-11-28 13:33:41 -06:00
|
|
|
The Admin Organizations HTTP API does not currently work with an API Token. API Tokens are currently
|
2018-06-29 12:08:38 -05:00
|
|
|
only linked to an organization and an organization role. They cannot be given the permission of server
|
|
|
|
admin, only users can be given that permission. So in order to use these API calls you will have to
|
|
|
|
use Basic Auth and the Grafana user must have the Grafana Admin permission (The default admin user
|
|
|
|
is called `admin` and has permission to use this API).
|
|
|
|
|
2018-11-28 13:33:41 -06:00
|
|
|
### Get Organization by Id
|
2018-06-29 12:08:38 -05:00
|
|
|
|
|
|
|
`GET /api/orgs/:orgId`
|
2016-02-03 00:59:22 -06:00
|
|
|
|
2018-11-28 13:33:41 -06:00
|
|
|
Only works with Basic Authentication (username and password), see [introduction](#admin-organizations-api).
|
2016-02-03 00:59:22 -06:00
|
|
|
|
|
|
|
**Example Request**:
|
|
|
|
|
2017-10-05 12:01:03 -05:00
|
|
|
```http
|
2018-06-29 12:08:38 -05:00
|
|
|
GET /api/orgs/1 HTTP/1.1
|
2017-10-05 12:01:03 -05:00
|
|
|
Accept: application/json
|
|
|
|
Content-Type: application/json
|
|
|
|
```
|
2016-02-03 00:59:22 -06:00
|
|
|
|
|
|
|
**Example Response**:
|
|
|
|
|
2017-10-05 12:01:03 -05:00
|
|
|
```http
|
|
|
|
HTTP/1.1 200
|
|
|
|
Content-Type: application/json
|
2016-02-03 00:59:22 -06:00
|
|
|
|
2018-06-29 12:08:38 -05:00
|
|
|
{
|
|
|
|
"id":1,
|
|
|
|
"name":"Main Org.",
|
|
|
|
"address":{
|
|
|
|
"address1":"",
|
|
|
|
"address2":"",
|
|
|
|
"city":"",
|
|
|
|
"zipCode":"",
|
|
|
|
"state":"",
|
|
|
|
"country":""
|
|
|
|
}
|
|
|
|
}
|
2017-10-05 12:01:03 -05:00
|
|
|
```
|
2018-11-28 13:33:41 -06:00
|
|
|
### Get Organization by Name
|
2016-02-03 00:59:22 -06:00
|
|
|
|
2018-06-29 12:08:38 -05:00
|
|
|
`GET /api/orgs/name/:orgName`
|
2016-02-03 00:59:22 -06:00
|
|
|
|
2018-11-28 13:33:41 -06:00
|
|
|
Only works with Basic Authentication (username and password), see [introduction](#admin-organizations-api).
|
2016-02-03 00:59:22 -06:00
|
|
|
|
|
|
|
**Example Request**:
|
|
|
|
|
2017-10-05 12:01:03 -05:00
|
|
|
```http
|
2018-06-29 12:08:38 -05:00
|
|
|
GET /api/orgs/name/Main%20Org%2E HTTP/1.1
|
2017-10-05 12:01:03 -05:00
|
|
|
Accept: application/json
|
|
|
|
Content-Type: application/json
|
|
|
|
```
|
2016-02-03 00:59:22 -06:00
|
|
|
|
|
|
|
**Example Response**:
|
|
|
|
|
2017-10-05 12:01:03 -05:00
|
|
|
```http
|
|
|
|
HTTP/1.1 200
|
|
|
|
Content-Type: application/json
|
2016-02-03 00:59:22 -06:00
|
|
|
|
2018-06-29 12:08:38 -05:00
|
|
|
{
|
|
|
|
"id":1,
|
|
|
|
"name":"Main Org.",
|
|
|
|
"address":{
|
|
|
|
"address1":"",
|
|
|
|
"address2":"",
|
|
|
|
"city":"",
|
|
|
|
"zipCode":"",
|
|
|
|
"state":"",
|
|
|
|
"country":""
|
|
|
|
}
|
|
|
|
}
|
2017-10-05 12:01:03 -05:00
|
|
|
```
|
2016-02-03 00:59:22 -06:00
|
|
|
|
2018-11-28 13:33:41 -06:00
|
|
|
### Create Organization
|
2016-02-03 00:59:22 -06:00
|
|
|
|
2018-06-29 12:08:38 -05:00
|
|
|
`POST /api/orgs`
|
|
|
|
|
2018-11-28 13:33:41 -06:00
|
|
|
Only works with Basic Authentication (username and password), see [introduction](#admin-organizations-api).
|
2016-02-03 00:59:22 -06:00
|
|
|
|
|
|
|
**Example Request**:
|
|
|
|
|
2017-10-05 12:01:03 -05:00
|
|
|
```http
|
2018-06-29 12:08:38 -05:00
|
|
|
POST /api/orgs HTTP/1.1
|
2017-10-05 12:01:03 -05:00
|
|
|
Accept: application/json
|
|
|
|
Content-Type: application/json
|
2018-06-29 12:08:38 -05:00
|
|
|
|
|
|
|
{
|
|
|
|
"name":"New Org."
|
|
|
|
}
|
2017-10-05 12:01:03 -05:00
|
|
|
```
|
2018-06-29 12:08:38 -05:00
|
|
|
Note: The api will work in the following two ways
|
|
|
|
1) Need to set GF_USERS_ALLOW_ORG_CREATE=true
|
|
|
|
2) Set the config users.allow_org_create to true in ini file
|
2016-02-03 00:59:22 -06:00
|
|
|
|
|
|
|
**Example Response**:
|
|
|
|
|
2017-10-05 12:01:03 -05:00
|
|
|
```http
|
|
|
|
HTTP/1.1 200
|
|
|
|
Content-Type: application/json
|
2016-02-03 00:59:22 -06:00
|
|
|
|
2018-06-29 12:08:38 -05:00
|
|
|
{
|
|
|
|
"orgId":"1",
|
|
|
|
"message":"Organization created"
|
|
|
|
}
|
2017-10-05 12:01:03 -05:00
|
|
|
```
|
2016-02-03 00:59:22 -06:00
|
|
|
|
2018-11-28 13:33:41 -06:00
|
|
|
### Search all Organizations
|
2016-02-03 00:59:22 -06:00
|
|
|
|
|
|
|
`GET /api/orgs`
|
|
|
|
|
2018-11-28 13:33:41 -06:00
|
|
|
Only works with Basic Authentication (username and password), see [introduction](#admin-organizations-api).
|
2018-06-29 12:08:38 -05:00
|
|
|
|
2016-02-03 00:59:22 -06:00
|
|
|
**Example Request**:
|
|
|
|
|
2017-10-05 12:01:03 -05:00
|
|
|
```http
|
|
|
|
GET /api/orgs HTTP/1.1
|
|
|
|
Accept: application/json
|
|
|
|
Content-Type: application/json
|
|
|
|
```
|
2017-10-25 01:15:51 -05:00
|
|
|
Note: The api will only work when you pass the admin name and password
|
2019-09-23 09:07:11 -05:00
|
|
|
to the request HTTP url, like http://admin:admin@localhost:3000/api/orgs
|
2016-02-03 00:59:22 -06:00
|
|
|
|
|
|
|
**Example Response**:
|
|
|
|
|
2017-10-05 12:01:03 -05:00
|
|
|
```http
|
|
|
|
HTTP/1.1 200
|
|
|
|
Content-Type: application/json
|
2016-02-03 00:59:22 -06:00
|
|
|
|
2017-10-05 12:01:03 -05:00
|
|
|
[
|
|
|
|
{
|
|
|
|
"id":1,
|
|
|
|
"name":"Main Org."
|
|
|
|
}
|
|
|
|
]
|
|
|
|
```
|
2016-02-03 00:59:22 -06:00
|
|
|
|
2018-11-28 13:33:41 -06:00
|
|
|
### Update Organization
|
2016-02-03 00:59:22 -06:00
|
|
|
|
|
|
|
`PUT /api/orgs/:orgId`
|
|
|
|
|
2018-11-28 13:33:41 -06:00
|
|
|
Update Organization, fields *Address 1*, *Address 2*, *City* are not implemented yet.
|
|
|
|
Only works with Basic Authentication (username and password), see [introduction](#admin-organizations-api).
|
2016-02-03 00:59:22 -06:00
|
|
|
|
|
|
|
**Example Request**:
|
|
|
|
|
2017-10-05 12:01:03 -05:00
|
|
|
```http
|
|
|
|
PUT /api/orgs/1 HTTP/1.1
|
|
|
|
Accept: application/json
|
|
|
|
Content-Type: application/json
|
2016-02-03 00:59:22 -06:00
|
|
|
|
2017-10-05 12:01:03 -05:00
|
|
|
{
|
|
|
|
"name":"Main Org 2."
|
|
|
|
}
|
|
|
|
```
|
2016-02-03 00:59:22 -06:00
|
|
|
|
|
|
|
**Example Response**:
|
|
|
|
|
2017-10-05 12:01:03 -05:00
|
|
|
```http
|
|
|
|
HTTP/1.1 200
|
|
|
|
Content-Type: application/json
|
2016-02-03 00:59:22 -06:00
|
|
|
|
2017-10-05 12:01:03 -05:00
|
|
|
{"message":"Organization updated"}
|
|
|
|
```
|
2016-02-03 00:59:22 -06:00
|
|
|
|
2018-11-28 13:33:41 -06:00
|
|
|
### Delete Organization
|
2018-06-14 14:25:45 -05:00
|
|
|
|
|
|
|
`DELETE /api/orgs/:orgId`
|
|
|
|
|
2018-11-28 13:33:41 -06:00
|
|
|
Only works with Basic Authentication (username and password), see [introduction](#admin-organizations-api).
|
2018-06-29 12:08:38 -05:00
|
|
|
|
2018-06-14 14:25:45 -05:00
|
|
|
**Example Request**:
|
|
|
|
|
|
|
|
```http
|
|
|
|
DELETE /api/orgs/1 HTTP/1.1
|
|
|
|
Accept: application/json
|
|
|
|
```
|
|
|
|
|
|
|
|
**Example Response**:
|
|
|
|
|
|
|
|
```http
|
|
|
|
HTTP/1.1 200
|
|
|
|
Content-Type: application/json
|
|
|
|
|
|
|
|
{"message":"Organization deleted"}
|
|
|
|
```
|
|
|
|
|
2018-11-28 13:33:41 -06:00
|
|
|
### Get Users in Organization
|
2016-02-03 00:59:22 -06:00
|
|
|
|
|
|
|
`GET /api/orgs/:orgId/users`
|
|
|
|
|
2018-11-28 13:33:41 -06:00
|
|
|
Only works with Basic Authentication (username and password), see [introduction](#admin-organizations-api).
|
2018-06-29 12:08:38 -05:00
|
|
|
|
2016-02-03 00:59:22 -06:00
|
|
|
**Example Request**:
|
|
|
|
|
2017-10-05 12:01:03 -05:00
|
|
|
```http
|
|
|
|
GET /api/orgs/1/users HTTP/1.1
|
|
|
|
Accept: application/json
|
|
|
|
Content-Type: application/json
|
|
|
|
```
|
2017-10-25 01:15:51 -05:00
|
|
|
Note: The api will only work when you pass the admin name and password
|
2019-09-23 09:07:11 -05:00
|
|
|
to the request HTTP url, like http://admin:admin@localhost:3000/api/orgs/1/users
|
2017-10-25 01:15:51 -05:00
|
|
|
|
2016-02-03 00:59:22 -06:00
|
|
|
|
|
|
|
**Example Response**:
|
|
|
|
|
2017-10-05 12:01:03 -05:00
|
|
|
```http
|
|
|
|
HTTP/1.1 200
|
|
|
|
Content-Type: application/json
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"orgId":1,
|
|
|
|
"userId":1,
|
|
|
|
"email":"admin@mygraf.com",
|
|
|
|
"login":"admin",
|
|
|
|
"role":"Admin"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
```
|
2016-02-03 00:59:22 -06:00
|
|
|
|
2018-11-28 13:33:41 -06:00
|
|
|
### Add User in Organization
|
2016-02-03 00:59:22 -06:00
|
|
|
|
|
|
|
`POST /api/orgs/:orgId/users`
|
|
|
|
|
2018-11-28 13:33:41 -06:00
|
|
|
Only works with Basic Authentication (username and password), see [introduction](#admin-organizations-api).
|
2018-06-29 12:08:38 -05:00
|
|
|
|
2016-02-03 00:59:22 -06:00
|
|
|
**Example Request**:
|
|
|
|
|
2017-10-05 12:01:03 -05:00
|
|
|
```http
|
|
|
|
POST /api/orgs/1/users HTTP/1.1
|
|
|
|
Accept: application/json
|
|
|
|
Content-Type: application/json
|
2016-02-03 00:59:22 -06:00
|
|
|
|
2017-10-05 12:01:03 -05:00
|
|
|
{
|
|
|
|
"loginOrEmail":"user",
|
|
|
|
"role":"Viewer"
|
|
|
|
}
|
|
|
|
```
|
2016-02-03 00:59:22 -06:00
|
|
|
|
|
|
|
**Example Response**:
|
|
|
|
|
2017-10-05 12:01:03 -05:00
|
|
|
```http
|
|
|
|
HTTP/1.1 200
|
|
|
|
Content-Type: application/json
|
2016-02-03 00:59:22 -06:00
|
|
|
|
2017-10-05 12:01:03 -05:00
|
|
|
{"message":"User added to organization"}
|
|
|
|
```
|
2016-02-03 00:59:22 -06:00
|
|
|
|
2018-11-28 13:33:41 -06:00
|
|
|
### Update Users in Organization
|
2016-02-03 00:59:22 -06:00
|
|
|
|
|
|
|
`PATCH /api/orgs/:orgId/users/:userId`
|
|
|
|
|
2018-11-28 13:33:41 -06:00
|
|
|
Only works with Basic Authentication (username and password), see [introduction](#admin-organizations-api).
|
2018-06-29 12:08:38 -05:00
|
|
|
|
2016-02-03 00:59:22 -06:00
|
|
|
**Example Request**:
|
|
|
|
|
2017-10-05 12:01:03 -05:00
|
|
|
```http
|
|
|
|
PATCH /api/orgs/1/users/2 HTTP/1.1
|
|
|
|
Accept: application/json
|
|
|
|
Content-Type: application/json
|
2016-02-03 00:59:22 -06:00
|
|
|
|
2017-10-05 12:01:03 -05:00
|
|
|
{
|
|
|
|
"role":"Admin"
|
|
|
|
}
|
|
|
|
```
|
2016-02-03 00:59:22 -06:00
|
|
|
|
|
|
|
**Example Response**:
|
|
|
|
|
2017-10-05 12:01:03 -05:00
|
|
|
```http
|
|
|
|
HTTP/1.1 200
|
|
|
|
Content-Type: application/json
|
2016-02-03 00:59:22 -06:00
|
|
|
|
2017-10-05 12:01:03 -05:00
|
|
|
{"message":"Organization user updated"}
|
|
|
|
```
|
2016-02-03 00:59:22 -06:00
|
|
|
|
2018-11-28 13:33:41 -06:00
|
|
|
### Delete User in Organization
|
2016-02-03 00:59:22 -06:00
|
|
|
|
|
|
|
`DELETE /api/orgs/:orgId/users/:userId`
|
|
|
|
|
2018-11-28 13:33:41 -06:00
|
|
|
Only works with Basic Authentication (username and password), see [introduction](#admin-organizations-api).
|
2018-06-29 12:08:38 -05:00
|
|
|
|
2016-02-03 00:59:22 -06:00
|
|
|
**Example Request**:
|
|
|
|
|
2017-10-05 12:01:03 -05:00
|
|
|
```http
|
|
|
|
DELETE /api/orgs/1/users/2 HTTP/1.1
|
|
|
|
Accept: application/json
|
|
|
|
Content-Type: application/json
|
|
|
|
```
|
2016-02-03 00:59:22 -06:00
|
|
|
|
|
|
|
**Example Response**:
|
|
|
|
|
2017-10-05 12:01:03 -05:00
|
|
|
```http
|
|
|
|
HTTP/1.1 200
|
|
|
|
Content-Type: application/json
|
2016-02-03 00:59:22 -06:00
|
|
|
|
2017-10-05 12:01:03 -05:00
|
|
|
{"message":"User removed from organization"}
|
2018-04-13 13:02:45 -05:00
|
|
|
```
|