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 Desk Resources

                            • Desk Community Learning Series


                            • Digest


                            • Functions


                            • Meetups


                            • Kbase


                            • Resources


                            • Glossary


                            • Desk Marketplace


                            • MVP Corner


                            • Word of the Day



                                Zoho Marketing Automation


                                        Manage your brands on social media



                                                Zoho TeamInbox Resources

                                                  Zoho DataPrep Resources



                                                    Zoho CRM Plus Resources

                                                      Zoho Books Resources


                                                        Zoho Subscriptions Resources

                                                          Zoho Projects Resources


                                                            Zoho Sprints Resources


                                                              Qntrl Resources


                                                                Zoho Creator Resources


                                                                  Zoho WorkDrive Resources



                                                                    Zoho Campaigns Resources

                                                                      Zoho CRM Resources

                                                                      • CRM Community Learning Series

                                                                        CRM Community Learning Series


                                                                      • Tips

                                                                        Tips

                                                                      • Functions

                                                                        Functions

                                                                      • Meetups

                                                                        Meetups

                                                                      • Kbase

                                                                        Kbase

                                                                      • Resources

                                                                        Resources

                                                                      • Digest

                                                                        Digest

                                                                      • CRM Marketplace

                                                                        CRM Marketplace

                                                                      • MVP Corner

                                                                        MVP Corner

                                                                      





                                                                      




                                                                          Design. Discuss. Deliver.

                                                                          Create visually engaging stories with Zoho Show.

                                                                          Get Started Now