I used the access key to curl /api/org API, can response with 404 status code.
What’s wrong?
I updated the latest grafana docker version, and the same 404 exception returned.
I use env GF_USERS_ALLOW_ORG_CREATE=true
and (GET)/api/org/ can be accessed and responsed
(POST)/api/orgs can create new organizations, however the two apis are not working
those are “/api/orgs/:orgId” & “/api/orgs/name/:orgName”
I request one little PR to merge the url endpoint wrong…
PR link:
https://github.com/grafana/grafana/pull/9641
{u’message’: u’Permission denied’}
{u’message’: u’Permission denied’}
{u’message’: u’Permission denied’}
The following API that I am now using all returned 'Permission denied’
searchAllOrganizations
getOrganizationById
getOrganizationByName
getOrganizationUsers
INFO[10-24|09:42:26] Request Completed logger=context userId=0 orgId=1 uname= method=GET path=/api/orgs status=403 remote_addr=172.17.0.1 time_ms=25 size=31 referer=
INFO[10-24|09:42:26] Request Completed logger=context userId=0 orgId=1 uname= method=GET path=/api/orgs/2 status=403 remote_addr=172.17.0.1 time_ms=25 size=31 referer=
INFO[10-24|09:42:26] Request Completed logger=context userId=0 orgId=1 uname= method=GET path="/api/orgs/name/Created New Org." status=403 remote_addr=172.17.0.1 time_ms=24 size=31 referer=
EROR[10-24|09:42:26] Organization name taken logger=context userId=0 orgId=1 uname= error="Organization name is taken"
INFO[10-24|09:42:26] Request Completed logger=context userId=0 orgId=1 uname= method=POST path=/api/orgs status=409 remote_addr=172.17.0.1 time_ms=27 size=37 referer=
INFO[10-24|09:42:26] Request Completed logger=context userId=0 orgId=1 uname= method=POST path=/api/orgs/1/users status=403 remote_addr=172.17.0.1 time_ms=23 size=31 referer=
The docs for some of the HTTP API calls are terrible (it is on our backlog to improve them and to create more tutorials). Some api calls require Basic Auth and an Admin user but it is hard to make out what your problem is now. What calls are not working?
Don’t know if you saw this - it might help a bit: Tutorial for How To Create API Tokens And Dashboards For A Specific Organization.
Yeah, I’ve just noticed the link you recommended.
For this API, I did not add auth user name and password in front of grafana link, and also did work. But I used the api Key.
The API is some kind like not uniformed!
I used api key to curl GET_ORGANIZATION_USERS_BY_ID (/api/orgs/{}/users), but return out “Permission denied”, however, I used the admin/secret in the curl url, then come out the right result!
I wanna know if next version will make the api better, and how big the changes will be, because some service may be affected if the api changed!
We don’t have any plans to make large changes to the API in the near future. We will however document it better and maybe improve some parts that are hard to use. The API is Grafana’s internal API and was not built as an external api which is why it suffers from poor documentation and some strange patterns.