Update codebox (#9430)
* updated the codeboxes in docs * codebox change from json to http
This commit is contained in:
committed by
Torkel Ödegaard
parent
19b5d91b75
commit
81be4e2612
+233
-205
@@ -23,158 +23,162 @@ Only works with Basic Authentication (username and password). See [introduction]
|
||||
|
||||
**Example Request**:
|
||||
|
||||
GET /api/admin/settings
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
```bash
|
||||
GET /api/admin/settings
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"DEFAULT":
|
||||
{
|
||||
"app_mode":"production"},
|
||||
"analytics":
|
||||
{
|
||||
"google_analytics_ua_id":"",
|
||||
"reporting_enabled":"false"
|
||||
},
|
||||
"auth.anonymous":{
|
||||
"enabled":"true",
|
||||
"org_name":"Main Org.",
|
||||
"org_role":"Viewer"
|
||||
},
|
||||
"auth.basic":{
|
||||
"enabled":"false"
|
||||
},
|
||||
"auth.github":{
|
||||
"allow_sign_up":"false",
|
||||
"allowed_domains":"",
|
||||
"allowed_organizations":"",
|
||||
"api_url":"https://api.github.com/user",
|
||||
"auth_url":"https://github.com/login/oauth/authorize",
|
||||
"client_id":"some_id",
|
||||
"client_secret":"************",
|
||||
"enabled":"false",
|
||||
"scopes":"user:email",
|
||||
"team_ids":"",
|
||||
"token_url":"https://github.com/login/oauth/access_token"
|
||||
},
|
||||
"auth.google":{
|
||||
"allow_sign_up":"false","allowed_domains":"",
|
||||
"api_url":"https://www.googleapis.com/oauth2/v1/userinfo",
|
||||
"auth_url":"https://accounts.google.com/o/oauth2/auth",
|
||||
"client_id":"some_client_id",
|
||||
"client_secret":"************",
|
||||
"enabled":"false",
|
||||
"scopes":"https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email",
|
||||
"token_url":"https://accounts.google.com/o/oauth2/token"
|
||||
},
|
||||
"auth.ldap":{
|
||||
"config_file":"/etc/grafana/ldap.toml",
|
||||
"enabled":"false"
|
||||
},
|
||||
"auth.proxy":{
|
||||
"auto_sign_up":"true",
|
||||
"enabled":"false",
|
||||
"header_name":"X-WEBAUTH-USER",
|
||||
"header_property":"username"
|
||||
},
|
||||
"dashboards.json":{
|
||||
"enabled":"false",
|
||||
"path":"/var/lib/grafana/dashboards"
|
||||
},
|
||||
"database":{
|
||||
"host":"127.0.0.1:0000",
|
||||
"name":"grafana",
|
||||
"password":"************",
|
||||
"path":"grafana.db",
|
||||
"ssl_mode":"disable",
|
||||
"type":"sqlite3",
|
||||
"user":"root"
|
||||
},
|
||||
"emails":{
|
||||
"templates_pattern":"emails/*.html",
|
||||
"welcome_email_on_sign_up":"false"
|
||||
},
|
||||
"event_publisher":{
|
||||
"enabled":"false",
|
||||
"exchange":"grafana_events",
|
||||
"rabbitmq_url":"amqp://localhost/"
|
||||
},
|
||||
"log":{
|
||||
"buffer_len":"10000",
|
||||
"level":"Info",
|
||||
"mode":"file"
|
||||
},
|
||||
"log.console":{
|
||||
"level":""
|
||||
},
|
||||
"log.file":{
|
||||
"daily_rotate":"true",
|
||||
"file_name":"",
|
||||
"level":"",
|
||||
"log_rotate":"true",
|
||||
"max_days":"7",
|
||||
"max_lines":"1000000",
|
||||
"max_lines_shift":"28",
|
||||
"max_size_shift":""
|
||||
},
|
||||
"paths":{
|
||||
"data":"/tsdb/grafana",
|
||||
"logs":"/logs/apps/grafana"},
|
||||
"security":{
|
||||
"admin_password":"************",
|
||||
"admin_user":"admin",
|
||||
"cookie_remember_name":"grafana_remember",
|
||||
"cookie_username":"grafana_user",
|
||||
"disable_gravatar":"false",
|
||||
"login_remember_days":"7",
|
||||
"secret_key":"************"
|
||||
},
|
||||
"server":{
|
||||
"cert_file":"",
|
||||
"cert_key":"",
|
||||
"domain":"mygraf.com",
|
||||
"enable_gzip":"false",
|
||||
"enforce_domain":"false",
|
||||
"http_addr":"127.0.0.1",
|
||||
"http_port":"0000",
|
||||
"protocol":"http",
|
||||
"root_url":"%(protocol)s://%(domain)s:%(http_port)s/",
|
||||
"router_logging":"true",
|
||||
"data_proxy_logging":"true",
|
||||
"static_root_path":"public"
|
||||
},
|
||||
"session":{
|
||||
"cookie_name":"grafana_sess",
|
||||
"cookie_secure":"false",
|
||||
"gc_interval_time":"",
|
||||
"provider":"file",
|
||||
"provider_config":"sessions",
|
||||
"session_life_time":"86400"
|
||||
},
|
||||
"smtp":{
|
||||
"cert_file":"",
|
||||
"enabled":"false",
|
||||
"from_address":"admin@grafana.localhost",
|
||||
"from_name":"Grafana",
|
||||
"ehlo_identity":"dashboard.example.com",
|
||||
"host":"localhost:25",
|
||||
"key_file":"",
|
||||
"password":"************",
|
||||
"skip_verify":"false",
|
||||
"user":""},
|
||||
"users":{
|
||||
"allow_org_create":"true",
|
||||
"allow_sign_up":"false",
|
||||
"auto_assign_org":"true",
|
||||
"auto_assign_org_role":"Viewer"
|
||||
}
|
||||
}
|
||||
```bash
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"DEFAULT":
|
||||
{
|
||||
"app_mode":"production"},
|
||||
"analytics":
|
||||
{
|
||||
"google_analytics_ua_id":"",
|
||||
"reporting_enabled":"false"
|
||||
},
|
||||
"auth.anonymous":{
|
||||
"enabled":"true",
|
||||
"org_name":"Main Org.",
|
||||
"org_role":"Viewer"
|
||||
},
|
||||
"auth.basic":{
|
||||
"enabled":"false"
|
||||
},
|
||||
"auth.github":{
|
||||
"allow_sign_up":"false",
|
||||
"allowed_domains":"",
|
||||
"allowed_organizations":"",
|
||||
"api_url":"https://api.github.com/user",
|
||||
"auth_url":"https://github.com/login/oauth/authorize",
|
||||
"client_id":"some_id",
|
||||
"client_secret":"************",
|
||||
"enabled":"false",
|
||||
"scopes":"user:email",
|
||||
"team_ids":"",
|
||||
"token_url":"https://github.com/login/oauth/access_token"
|
||||
},
|
||||
"auth.google":{
|
||||
"allow_sign_up":"false","allowed_domains":"",
|
||||
"api_url":"https://www.googleapis.com/oauth2/v1/userinfo",
|
||||
"auth_url":"https://accounts.google.com/o/oauth2/auth",
|
||||
"client_id":"some_client_id",
|
||||
"client_secret":"************",
|
||||
"enabled":"false",
|
||||
"scopes":"https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email",
|
||||
"token_url":"https://accounts.google.com/o/oauth2/token"
|
||||
},
|
||||
"auth.ldap":{
|
||||
"config_file":"/etc/grafana/ldap.toml",
|
||||
"enabled":"false"
|
||||
},
|
||||
"auth.proxy":{
|
||||
"auto_sign_up":"true",
|
||||
"enabled":"false",
|
||||
"header_name":"X-WEBAUTH-USER",
|
||||
"header_property":"username"
|
||||
},
|
||||
"dashboards.json":{
|
||||
"enabled":"false",
|
||||
"path":"/var/lib/grafana/dashboards"
|
||||
},
|
||||
"database":{
|
||||
"host":"127.0.0.1:0000",
|
||||
"name":"grafana",
|
||||
"password":"************",
|
||||
"path":"grafana.db",
|
||||
"ssl_mode":"disable",
|
||||
"type":"sqlite3",
|
||||
"user":"root"
|
||||
},
|
||||
"emails":{
|
||||
"templates_pattern":"emails/*.html",
|
||||
"welcome_email_on_sign_up":"false"
|
||||
},
|
||||
"event_publisher":{
|
||||
"enabled":"false",
|
||||
"exchange":"grafana_events",
|
||||
"rabbitmq_url":"amqp://localhost/"
|
||||
},
|
||||
"log":{
|
||||
"buffer_len":"10000",
|
||||
"level":"Info",
|
||||
"mode":"file"
|
||||
},
|
||||
"log.console":{
|
||||
"level":""
|
||||
},
|
||||
"log.file":{
|
||||
"daily_rotate":"true",
|
||||
"file_name":"",
|
||||
"level":"",
|
||||
"log_rotate":"true",
|
||||
"max_days":"7",
|
||||
"max_lines":"1000000",
|
||||
"max_lines_shift":"28",
|
||||
"max_size_shift":""
|
||||
},
|
||||
"paths":{
|
||||
"data":"/tsdb/grafana",
|
||||
"logs":"/logs/apps/grafana"},
|
||||
"security":{
|
||||
"admin_password":"************",
|
||||
"admin_user":"admin",
|
||||
"cookie_remember_name":"grafana_remember",
|
||||
"cookie_username":"grafana_user",
|
||||
"disable_gravatar":"false",
|
||||
"login_remember_days":"7",
|
||||
"secret_key":"************"
|
||||
},
|
||||
"server":{
|
||||
"cert_file":"",
|
||||
"cert_key":"",
|
||||
"domain":"mygraf.com",
|
||||
"enable_gzip":"false",
|
||||
"enforce_domain":"false",
|
||||
"http_addr":"127.0.0.1",
|
||||
"http_port":"0000",
|
||||
"protocol":"http",
|
||||
"root_url":"%(protocol)s://%(domain)s:%(http_port)s/",
|
||||
"router_logging":"true",
|
||||
"data_proxy_logging":"true",
|
||||
"static_root_path":"public"
|
||||
},
|
||||
"session":{
|
||||
"cookie_name":"grafana_sess",
|
||||
"cookie_secure":"false",
|
||||
"gc_interval_time":"",
|
||||
"provider":"file",
|
||||
"provider_config":"sessions",
|
||||
"session_life_time":"86400"
|
||||
},
|
||||
"smtp":{
|
||||
"cert_file":"",
|
||||
"enabled":"false",
|
||||
"from_address":"admin@grafana.localhost",
|
||||
"from_name":"Grafana",
|
||||
"ehlo_identity":"dashboard.example.com",
|
||||
"host":"localhost:25",
|
||||
"key_file":"",
|
||||
"password":"************",
|
||||
"skip_verify":"false",
|
||||
"user":""
|
||||
},
|
||||
"users":{
|
||||
"allow_org_create":"true",
|
||||
"allow_sign_up":"false",
|
||||
"auto_assign_org":"true",
|
||||
"auto_assign_org_role":"Viewer"
|
||||
}
|
||||
}
|
||||
```
|
||||
## Grafana Stats
|
||||
|
||||
`GET /api/admin/stats`
|
||||
@@ -183,26 +187,30 @@ Only works with Basic Authentication (username and password). See [introduction]
|
||||
|
||||
**Example Request**:
|
||||
|
||||
GET /api/admin/stats
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
```bash
|
||||
GET /api/admin/stats
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
```json
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"user_count":2,
|
||||
"org_count":1,
|
||||
"dashboard_count":4,
|
||||
"db_snapshot_count":2,
|
||||
"db_tag_count":6,
|
||||
"data_source_count":1,
|
||||
"playlist_count":1,
|
||||
"starred_db_count":2,
|
||||
"grafana_admin_count":2
|
||||
}
|
||||
{
|
||||
"user_count":2,
|
||||
"org_count":1,
|
||||
"dashboard_count":4,
|
||||
"db_snapshot_count":2,
|
||||
"db_tag_count":6,
|
||||
"data_source_count":1,
|
||||
"playlist_count":1,
|
||||
"starred_db_count":2,
|
||||
"grafana_admin_count":2
|
||||
}
|
||||
```
|
||||
|
||||
## Global Users
|
||||
|
||||
@@ -211,24 +219,28 @@ Only works with Basic Authentication (username and password). See [introduction]
|
||||
Create new user. Only works with Basic Authentication (username and password). See [introduction](http://docs.grafana.org/http_api/admin/#admin-api) for an explanation.
|
||||
|
||||
**Example Request**:
|
||||
```json
|
||||
|
||||
POST /api/admin/users HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
POST /api/admin/users HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"name":"User",
|
||||
"email":"user@graf.com",
|
||||
"login":"user",
|
||||
"password":"userpassword"
|
||||
}
|
||||
{
|
||||
"name":"User",
|
||||
"email":"user@graf.com",
|
||||
"login":"user",
|
||||
"password":"userpassword"
|
||||
}
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
```json
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
{"id":5,"message":"User created"}
|
||||
{"id":5,"message":"User created"}
|
||||
```
|
||||
|
||||
## Password for User
|
||||
|
||||
@@ -239,18 +251,22 @@ Change password for a specific user.
|
||||
|
||||
**Example Request**:
|
||||
|
||||
PUT /api/admin/users/2/password HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
```json
|
||||
PUT /api/admin/users/2/password HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
|
||||
{"password":"userpassword"}
|
||||
{"password":"userpassword"}
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
```json
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
{"message": "User password updated"}
|
||||
{"message": "User password updated"}
|
||||
```
|
||||
|
||||
## Permissions
|
||||
|
||||
@@ -260,18 +276,22 @@ Only works with Basic Authentication (username and password). See [introduction]
|
||||
|
||||
**Example Request**:
|
||||
|
||||
PUT /api/admin/users/2/permissions HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
```json
|
||||
PUT /api/admin/users/2/permissions HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
|
||||
{"isGrafanaAdmin": true}
|
||||
{"isGrafanaAdmin": true}
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
```json
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
{message: "User permissions updated"}
|
||||
{message: "User permissions updated"}
|
||||
```
|
||||
|
||||
## Delete global User
|
||||
|
||||
@@ -281,16 +301,20 @@ Only works with Basic Authentication (username and password). See [introduction]
|
||||
|
||||
**Example Request**:
|
||||
|
||||
DELETE /api/admin/users/2 HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
```json
|
||||
DELETE /api/admin/users/2 HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
```json
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
{message: "User deleted"}
|
||||
{message: "User deleted"}
|
||||
```
|
||||
|
||||
## Pause all alerts
|
||||
|
||||
@@ -300,13 +324,15 @@ Only works with Basic Authentication (username and password). See [introduction]
|
||||
|
||||
**Example Request**:
|
||||
|
||||
POST /api/admin/pause-all-alerts HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
```json
|
||||
POST /api/admin/pause-all-alerts HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"paused": true
|
||||
}
|
||||
{
|
||||
"paused": true
|
||||
}
|
||||
```
|
||||
|
||||
JSON Body schema:
|
||||
|
||||
@@ -314,7 +340,9 @@ JSON Body schema:
|
||||
|
||||
**Example Response**:
|
||||
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
```json
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
{state: "new state", message: "alerts pause/un paused", "alertsAffected": 100}
|
||||
{state: "new state", message: "alerts pause/un paused", "alertsAffected": 100}
|
||||
```
|
||||
Reference in New Issue
Block a user