Skip to content

Commit 13c4ce6

Browse files
utkarshcmutorkelo
authored andcommitted
Added name and id in response of create/update (grafana#7016)
1 parent fa01022 commit 13c4ce6

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

docs/sources/http_api/data_source.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ parent = "http_api"
158158
HTTP/1.1 200
159159
Content-Type: application/json
160160

161-
{"id":1,"message":"Datasource added"}
161+
{"id":1,"message":"Datasource added", "name": "test_datasource"}
162162

163163
## Update an existing data source
164164

@@ -193,7 +193,7 @@ parent = "http_api"
193193
HTTP/1.1 200
194194
Content-Type: application/json
195195

196-
{"message":"Datasource updated"}
196+
{"message":"Datasource updated", "id": 1, "name": "test_datasource"}
197197

198198
## Delete an existing data source
199199

pkg/api/datasources.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ func AddDataSource(c *middleware.Context, cmd m.AddDataSourceCommand) {
100100
return
101101
}
102102

103-
c.JSON(200, util.DynMap{"message": "Datasource added", "id": cmd.Result.Id})
103+
c.JSON(200, util.DynMap{"message": "Datasource added", "id": cmd.Result.Id, "name": cmd.Result.Name})
104104
}
105105

106106
func UpdateDataSource(c *middleware.Context, cmd m.UpdateDataSourceCommand) Response {
@@ -117,7 +117,7 @@ func UpdateDataSource(c *middleware.Context, cmd m.UpdateDataSourceCommand) Resp
117117
return ApiError(500, "Failed to update datasource", err)
118118
}
119119

120-
return Json(200, util.DynMap{"message": "Datasource updated"})
120+
return Json(200, util.DynMap{"message": "Datasource updated", "id": cmd.Id, "name": cmd.Name})
121121
}
122122

123123
func fillWithSecureJsonData(cmd *m.UpdateDataSourceCommand) error {

0 commit comments

Comments
 (0)