API: Enrich endpoints with ID (#26691)

pull/26719/head^2
Agnès Toulet 5 years ago committed by GitHub
parent 5cc65df32b
commit 8dc75f79f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      docs/sources/http_api/dashboard.md
  2. 5
      docs/sources/http_api/data_source.md
  3. 3
      docs/sources/http_api/folder.md
  4. 1
      pkg/api/dashboard.go
  5. 5
      pkg/api/datasources.go
  6. 1
      pkg/api/folder.go

@ -332,7 +332,11 @@ Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
HTTP/1.1 200 HTTP/1.1 200
Content-Type: application/json Content-Type: application/json
{"title": "Production Overview"} {
"title": "Production Overview",
"message": "Dashboard Production Overview deleted",
"id": 2
}
``` ```
Status Codes: Status Codes:
@ -506,7 +510,11 @@ Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
HTTP/1.1 200 HTTP/1.1 200
Content-Type: application/json Content-Type: application/json
{"title": "Production Overview"} {
"title": "Production Overview",
"message": "Dashboard Production Overview deleted",
"id": 2
}
``` ```
Status Codes: Status Codes:

@ -419,7 +419,10 @@ Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
HTTP/1.1 200 HTTP/1.1 200
Content-Type: application/json Content-Type: application/json
{"message":"Data source deleted"} {
"message":"Data source deleted",
"id": 1
}
``` ```
## Data source proxy calls ## Data source proxy calls

@ -264,7 +264,8 @@ HTTP/1.1 200
Content-Type: application/json Content-Type: application/json
{ {
"message":"Folder deleted" "message":"Folder deleted",
"id": 2
} }
``` ```

@ -210,6 +210,7 @@ func deleteDashboard(c *models.ReqContext) Response {
return JSON(200, util.DynMap{ return JSON(200, util.DynMap{
"title": dash.Title, "title": dash.Title,
"message": fmt.Sprintf("Dashboard %s deleted", dash.Title), "message": fmt.Sprintf("Dashboard %s deleted", dash.Title),
"id": dash.Id,
}) })
} }

@ -127,7 +127,10 @@ func DeleteDataSourceByName(c *models.ReqContext) Response {
return Error(500, "Failed to delete datasource", err) return Error(500, "Failed to delete datasource", err)
} }
return Success("Data source deleted") return JSON(200, util.DynMap{
"message": "Data source deleted",
"id": getCmd.Result.Id,
})
} }
func validateURL(tp string, u string) Response { func validateURL(tp string, u string) Response {

@ -93,6 +93,7 @@ func DeleteFolder(c *models.ReqContext) Response {
return JSON(200, util.DynMap{ return JSON(200, util.DynMap{
"title": f.Title, "title": f.Title,
"message": fmt.Sprintf("Folder %s deleted", f.Title), "message": fmt.Sprintf("Folder %s deleted", f.Title),
"id": f.Id,
}) })
} }

Loading…
Cancel
Save