Getting 500 code when trying to update account

Getting 500 code when trying to update account

Hello, 

I am having trouble to udpate any parameter using the API.

I am pretty sure that I am sending a correct Token and that it has the needed scope (Desk.contacts.UPDATE).

First I tried sending the whole information, but got the error, and I ma still getting the same error by just sending just one parameter:

  1. async function updateCompany(accountId, params){
  2.     let headers = httpCalls.buildHeaders();
  3.     let url = `https://desk.zoho.com/api/v1/accounts/${accountId}`;
  4.     let payload = JSON.stringify(params);
  5.     let opts = {
  6.       "method":"PATCH",
  7.       "headers":headers,
  8.       "payload":payload
  9.     }
  10.     let answer = await UrlFetchApp.fetch(url,opts);
  11.     return {
  12.       status: answer.getResponseCode(),
  13.       msg: answer.getContentText()
  14.     }
  15. }

  16. async function testUpdate(){
  17.   let verifiedId = 65046501652005 /*This number is just to show how it is called, the actual number it is of course a valid accountId*/
  18.   let info = {
  19.     accountName: "AccountName"
  20.   }
  21.   console.log(JSON.stringify(info));
  22.   let answer = await updateCompany(verifiedId, info);
  23.   
  24.   console.log(answer);
  25. }
I am pretty sure that headers and accountId are valid because I can get the company info with those same parameters, but no luck to update.

Any thoughts on this? Thank you in advance

    Access your files securely from anywhere

        Zoho Developer Community




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


                                                                          Zoho CRM Resources

                                                                          • CRM Community Learning Series

                                                                            CRM Community Learning Series


                                                                          • Kaizen

                                                                            Kaizen

                                                                          • 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