cancel
Showing results for 
Search instead for 
Did you mean: 

Using curl to bulk upload users with JSON file

Yousuf_Nejati
Star Contributor
Star Contributor

Hi,

I'm wondering if it's possible to upload many users to my Nuxeo instance by using Curl on a local JSON file. It's certainly possible for a single user, as I've already attempted.

' curl -u "Administrator:Administrator" -H "Content-Type: application/json" -d @/home/Desktop/BulkUserImports.json http://localhost:8080/nuxeo/api/v1/user '

I get the following exception with the JSON file below -

{"entity-type":"exception","code":"org.nuxeo.ecm.core.io.registry.MarshallingException","status":500,"message":"Json does not contain an object as expected"}

Is my JSON file not formatted properly for multiple user objects?

---- Begin JSON ----

[ { "entity-type": "user", "properties": { "username": "fourthUser", "lastName": "User", "firstName": "Fourth" } }, { "entity-type": "user", "properties": { "username": "secondUser", "lastName": "User", "firstName": "Second" } } ]

Thank you!

  • Yousuf
1 REPLY 1

Yousuf_Nejati
Star Contributor
Star Contributor

Hi,

After some further research and attempts, it seems that this is not possible (if anyone here knows otherwise, please feel free to comment) .

So, I scratched the whole JSON file idea and instead created a simple command line Java program that parses the original CSV input file and builds an executable file containing sequential curl statements (1-50) on the Desktop. I then execute the file via the terminal ("./myBulkCreateUserCurlRequests.sh") and it then creates the users in my Nuxeo instance.

Hope this helps.

-Yousuf

Getting started

Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.