hello all .. i'm trying to add a global role to our dataverse installation, and not getting very far. I've tried these formats for the api command:
curl http://localhost:8080/api/admin/roles -X POST -H 'Content-type:application/json' --upload-file roles.json
and
curl -H X-Dataverse-key:<my api token> -X POST "http://localhost:8080/api/admin/roles" --upload-file roles.json
and neither works .. for the first one it just returns nothing, and the second one returns "415 upsupported media type"
I used the format for the roles.json file that is in the docs
any thoughts?
I also tried: 
curl -H X-Dataverse-key:<my api token> -X POST http://localhost:8080/api/admin/roles -H 'Content-type:application/json' --upload-file roles.json
and using env variables for server, token and export ID (and using the command directly from the docs)
curl -H "X-Dataverse-key:$API_TOKEN" -X POST "$SERVER_URL/api/admin/roles" --upload-file roles.json
Hmm, I'm looking at this: Unify and de-duplicate role creation information. #9646
Does your JSON look something like this?
{
  "alias": "sys1",
  "name": βRestricted System Roleβ,
  "description": βA person who may only add datasets.β,
  "permissions": [
    "AddDataset"
  ]
}
From https://guides.dataverse.org/en/6.0/api/native-api.html#json-representation-of-a-role
yes here it is: 
{
  "alias": "dsRsrchContrib",
  "name": βResearch Contributorβ,
  "description": βLab manager, research data manager, graduate assistant.β,
  "permissions": [
       "ViewUnpublishedDataset",
      "DownloadFile",
       "EditDataset"
   ]
}
Basically, I'm trying to say the docs were clean up recently so if you aren't looking at 5.14 or 6.0 docs you should. :grinning:
although it is indented
yeah, that looks right
oh i'm looking at "latest"
https://guides.dataverse.org/en/latest/api/native-api.html#create-global-role
yeah, and latest is 6.0 right now, of course: https://guides.dataverse.org/en/6.0/api/native-api.html#create-global-role
That curl command matches the second one you posted.
should work!
anything in server.log?
hmmm .. i see this: "[Payara 6.2023.8] [SEVERE] [] [] [tid: _ThreadID=71 _ThreadName=http-thread-pool::http-listener-1(2)] [timeMillis: 1701457596607] [levelValue: 1000] [[
  jakarta.ws.rs.ProcessingException: Error deserializing object from entity stream."
and "Internal error: Unexpected char 8,220 at (line no=3, column no=11, offset=43)" .. must have something wrong in my json?
oh ho!
I see some not so smart quotes
yes, that must be it! haha .. didn't even notice that .. will fix and try again (sorry should have looked in the payara log)
well, we should probably return a better error
please feel free to open an issue about this
yep it worked .. omg i feel stupid
you could link back to this thread
glad it worked!
thank you so much! next time i will check the log first!
No worries. I don't mind easy problems on a Friday afternoon. :stuck_out_tongue_wink:
:big_smile:
Oliver Bertuch has marked this topic as resolved.
Last updated: Oct 30 2025 at 06:21 UTC