0

I am trying to create the grafana users using API's and this is what I tried.

curl -XPOST -H “Content-Type: application/json” -d ‘{“name”:“User”,“email”:“user@graf.com”,“login”:“user”,“password”:“password”}’ http://admin:admin@localhost:3000/api/admin/users

got this: [{“classification”:“DeserializationError”,“message”:“invalid character ‘\’’ looking for beginning of value”},{“fieldNames”:[“Password”],“classification”:“RequiredError”,“message”:“Required”}]

Can any one help me?

1 Answers1

0

I followed the http://docs.grafana.org/http_api/user/ documentation and now I am able to create the users and able to use all grafana api's

Here is the answer for my question

import requests
url='http://admin:admin@localhost:3000/api/admin/users'
data='''{
  "name":"tester",
  "email":"test@graadff.com",
  "login":"tester",
  "password":"test@123"
}'''
headers={"Content-Type": 'application/json'}
response = requests.post(url, data=data,headers=headers)
print (response.text)