API: Unable to create users

API: Unable to create users

I am trying to write a script that would synchronize the list of users on my company's Zoho account with our internal LDAP.

In that purpose, I have created an access token with the scopes ZohoExpense.users.CREATE and ZohoExpense.users.READ.

The script works by getting the list of users from Zoho and from the LDAP, making a diff, then sending API commands to Zoho to create the users that exist on the LDAP but not on Zoho.

Such commands look like this:
curl https://expense.zoho.com/api/v1/users -X POST -H "Content-Type: application/json;charset=UTF-8" -H "X-com-zoho-expense-organizationid: <MyOrgID>" -H "Authorization: Zoho-oauthtoken <MyAuthToken>" -d JSONString='{"name": "Firstname Lastname", "email": "flastname@mycompany.com", "user_role": "submitter"}'

The command is identical to the one described in the documentation (https://www.zoho.com/expense/api/v1/#Users_Create_an_user). Also, when removing the '-d ...' and '-X POST' arguments, the request is accepted and returns the list of users (as described in https://www.zoho.com/expense/api/v1/#Users_Retrieve_list_of_users). Therefore, the headers, including the auth token, are valid.

However, when creating a user, I get the following answer from the API:
{"code":4,"message":"Invalid value passed for JSONString"}

This error code is not really explicit, and talking to support has not helped much. it looks to me like the API documentation does not match reality. Has anyone tested this command ? Thanks

      Zoho SalesIQ Resources



            Zoho TeamInbox Resources

              Zoho DataPrep Resources


                  Zoho CRM Plus Resources

                    Zoho Books Resources


                      Zoho Subscriptions Resources

                        Zoho Desk Resources

                          Zoho Projects Resources


                            Zoho Sprints Resources


                              Qntrl Resources


                                Zoho Creator Resources


                                  Zoho WorkDrive Resources




                                      Zoho Campaigns Resources

                                        Zoho CRM Resources

                                                    Design. Discuss. Deliver.

                                                    Create visually engaging stories with Zoho Show.

                                                    Get Started Now


                                                      Zoho Show Resources


                                                        Zoho Writer Writer

                                                        Get Started. Write Away!

                                                        Writer is a powerful online word processor, designed for collaborative work.

                                                                  有料プランをご利用の方