Stream: dev

Topic: โœ” CURL command format for /api/admin POST request endpoint


view this post on Zulip Julien C (Oct 24 2023 at 15:42):

Hello Dataverse Community,

According to the documentation:
Create an Authenticated User: https://guides.dataverse.org/en/5.10/api/native-api.html#id169

What is the correct curl command to do that please ?

I have tried with -H "Content-Type: application/json" and --upload-file my_file.json where i have indicated the dictionary. This is not working.

And I have tried with -d and pass the dictionary directly: curl -H "X-Dataverse-key: $API_TOKEN" -X POST localhost:8080/api/admin/authenticatedUsers -d $TEST_AUTH_USER

I'm probably doing a mistake in the command,
Thanks in advance for your help,
regards

view this post on Zulip Philip Durbin ๐Ÿš€ (Oct 24 2023 at 16:04):

Those docs are terrible (please feel free to create an issue!) but this worked for me:

$ curl -H "Content-Type: application/json" http://localhost:8080/api/admin/authenticatedUsers -X POST --upload-file user.json

view this post on Zulip Julien C (Oct 25 2023 at 06:46):

Thank you Philip for your confirmation on this command.

EDIT 3: Ok seems to work, if I have already the user in database, the API return just an empty braces
If not I've got a detailed response which is ok.

@Phlip: is it correct that you don't need API_TOKEN here to do this?
This means that everyone who can access locally can add a user?

Regards

view this post on Zulip Notification Bot (Oct 25 2023 at 07:19):

Julien C has marked this topic as resolved.

view this post on Zulip Philip Durbin ๐Ÿš€ (Oct 25 2023 at 12:38):

That's correct. You don't need an API token for this one. Again, the docs are not great. Please feel free to open an issue.


Last updated: Nov 01 2025 at 14:11 UTC