Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
4acfa1fa
Commit
4acfa1fa
authored
Jul 21, 2015
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2378 from sbengo/improved_http_api_doc
Added details on api documentation
parents
55af0ce2
b9085c15
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
328 additions
and
4 deletions
+328
-4
docs/sources/reference/http_api.md
+328
-4
No files found.
docs/sources/reference/http_api.md
View file @
4acfa1fa
...
...
@@ -22,7 +22,7 @@ standard basic auth.
curl example:
```
❯
curl http://admin:admin@localhost:3000/api/org
?
curl http://admin:admin@localhost:3000/api/org
{"id":1,"name":"Main Org."}
```
...
...
@@ -158,10 +158,88 @@ The above will delete the dashboard with the specified slug. The slug is the url
`GET /api/dashboards/home`
Will return the home dashboard.
**Example Request**
:
GET /api/dashboards/home HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
**Example Response**
:
HTTP/1.1 200
Content-Type: application/json
{
"meta": {
"isHome":true,
"canSave":false,
"canEdit":false,
"canStar":false,
"slug":"",
"expires":"0001-01-01T00:00:00Z",
"created":"0001-01-01T00:00:00Z"
},
"dashboard": {
"editable":false,
"hideControls":true,
"nav":[
{
"enable":false,
"type":"timepicker"
}
],
"rows": [
{
}
],
"style":"dark",
"tags":[],
"templating":{
"list":[
]
},
"time":{
},
"timezone":"browser",
"title":"Home",
"version":5
}
}
### Tags for Dashboard
`GET /api/dashboards/tags`
Get all tabs of dashboards
**Example Request**
:
GET /api/dashboards/home HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
**Example Response**
:
HTTP/1.1 200
Content-Type: application/json
[
{
"term":"tag1",
"count":1
},
{
"term":"tag2",
"count":4
}
]
### Dashboard from JSON file
`GET /file/:file`
...
...
@@ -184,35 +262,165 @@ Status Codes:
Content-Type: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
**Example Response**
:
HTTP/1.1 200
Content-Type: application/json
[
{
"id":1,
"title":"Production Overview",
"uri":"db/production-overview",
"type":"dash-db",
"tags":[],
"isStarred":false
}
]
## Data sources
### Get all datasources
`GET /api/datasources`
**Example Request**
:
GET /api/datasources HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
**Example Response**
:
HTTP/1.1 200
Content-Type: application/json
[
{
"id":1,
"orgId":1,
"name":"datasource_elastic",
"type":"elasticsearch",
"access":"proxy",
"url":"http://mydatasource.com",
"password":"",
"user":"",
"database":"grafana-dash",
"basicAuth":false,
"basicAuthUser":"",
"basicAuthPassword":"",
"isDefault":false,
"jsonData":null
}
]
### Get a single data sources by Id
`GET /api/datasources/:datasourceId`
**Example Request**
:
GET /api/datasources/1 HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
**Example Response**
:
HTTP/1.1 200
Content-Type: application/json
{
"id":1,
"orgId":1,
"name":"test_datasource",
"type":"graphite",
"access":"proxy",
"url":"http://mydatasource.com",
"password":"",
"user":"",
"database":"",
"basicAuth":false,
"basicAuthUser":"",
"basicAuthPassword":"",
"isDefault":false,
"jsonData":null
}
### Create data source
`POST /api/datasources`
**Example Request**
:
POST /api/datasources HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
{
"name":"test_datasource",
"type":"graphite",
"url":"http://mydatasource.com",
"access":"proxy",
"basicAuth":false
}
**Example Response**
:
HTTP/1.1 200
Content-Type: application/json
{"message":"Datasource added"}
{"
id":1,"
message":"Datasource added"}
### Update an existing data source
`PUT /api/datasources/:datasourceId`
**Example Request**
:
PUT /api/datasources/1 HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
{
"id":1,
"orgId":1,
"name":"test_datasource",
"type":"graphite",
"access":"proxy",
"url":"http://mydatasource.com",
"password":"",
"user":"",
"database":"",
"basicAuth":true,
"basicAuthUser":"basicuser",
"basicAuthPassword":"basicuser",
"isDefault":false,
"jsonData":null
}
**Example Response**
:
HTTP/1.1 200
Content-Type: application/json
{"message":"Datasource updated"}
### Delete an existing data source
`DELETE /api/datasources/:datasourceId`
**Example Request**
:
DELETE /api/datasources/1 HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
**Example Response**
:
HTTP/1.1 200
...
...
@@ -224,6 +432,31 @@ Status Codes:
`GET /api/datasources/plugins`
**Example Request**
:
GET /api/datasources/plugins HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
**Example Response**
:
HTTP/1.1 200
Content-Type: application/json
{
"grafana":{
"metrics":true,"module":"plugins/datasource/grafana/datasource",
"name":"Grafana (for testing)",
"partials":{
"query":"app/plugins/datasource/grafana/partials/query.editor.html"
},
"pluginType":"datasource",
"serviceName":"GrafanaDatasource",
"type":"grafana"
}
}
## Data source proxy calls
`GET /api/datasources/proxy/:datasourceId/*`
...
...
@@ -236,27 +469,118 @@ Proxies all calls to the actual datasource.
`GET /api/org`
**Example Request**
:
GET /api/org HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
**Example Response**
:
HTTP/1.1 200
Content-Type: application/json
{
"id":1,
"name":"Main Org."
}
### Get all users within the actual organisation
`GET /api/org/users`
**Example Request**
:
GET /api/org/users HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
**Example Response**
:
HTTP/1.1 200
Content-Type: application/json
[
{
"orgId":1,
"userId":1,
"email":"admin@mygraf.com",
"login":"admin",
"role":"Admin"
}
]
### Add a new user to the actual organisation
`POST /api/org/users`
Adds a global user to the actual organisation.
**Example Request**
:
POST /api/org/users HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
{
"role": "Admin",
"loginOrEmail": "admin"
}
**Example Response**
:
HTTP/1.1 200
Content-Type: application/json
{"message":"User added to organization"}
### Updates the given user
`PATCH /api/org/users/:userId`
**Example Request**
:
PATCH /api/org/users/1 HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
{
"role": "Viewer",
}
**Example Response**
:
HTTP/1.1 200
Content-Type: application/json
{"message":"Organization user updated"}
### Delete user in actual organisation
`DELETE /api/org/users/:userId`
### Get all Users
**Example Request**
:
DELETE /api/org/users/1 HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
**Example Response**
:
HTTP/1.1 200
Content-Type: application/json
{"message":"User removed from organization"}
`GET /api/org/users`
## Organisations
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment