I am trying to create a new folder with CURL. However, when I try to create the folder via the HTTP API I am getting “folder title cannot be empty”.
I’m following the instructions on creating a folder here: Folder HTTP API | Grafana Labs
Here is my curl:
curl -k -X “POST” -H “Authorization: Bearer ${apikey}” ${baseurl}/api/folders -d ‘{“uid”: “nErXDvCkzz”,“title”:“Department ABC”}’
Response when I try running this:
{“message”:“folder title cannot be empty”}
The JSON for the payload is correct. I’m not sure why this isn’t working.
this worked for me once I added the content-type header:
curl -H "Authorization: Bearer my-api-key" -H "Content-Type: application/json" -X POST -k -d '{"uid": "nErXWvCkzz","title":"Department DEF"}' http://localhost:3003/api/folders
returned:
{"id":5,"uid":"nErXWvCkzz","title":"Department DEF","url":"/dashboards/f/nErXWvCkzz/department-def","hasAcl":false,"canSave":true,"canEdit":true,"canAdmin":true,"createdBy":"Anonymous","created":"2021-06-03T12:14:52-10:00","updatedBy":"Anonymous","updated":"2021-06-03T12:14:52-10:00","version":1}
kshull
3
Thanks Matt,
I’ll give that a try!
1 Like