6500 General Error when uploading files for a comment via the API

6500 General Error when uploading files for a comment via the API

Hello,

I am trying to create a comment for a task via the API, and upload files in the task comment.

When I use Postman, everything works fine, both the comment and files are added.

However, when I use axios in Node.js to send a POST request, I am getting an error. This is the code that I am using:

  1. const url = `https://projectsapi.zoho.eu/restapi/portal/${zoho.username}/projects/${zohoProject}/tasks/${req.body.id}/comments/?content=${req.body.comment}`;

  2. const formData = new FormData();

  3. formData.append('uploaddoc', fs.createReadStream(path.join(__dirname, '..', 'files', 'test.jpg')), { filename: 'test.jpg' });

  4. response = await axios.post(url, formData, {
  5.      headers: {
  6.           Authorization: 'Bearer ' + accessToken,
  7.           'Content-Type': 'multipart/form-data'
  8.      }
  9. });

The response I receive from the API is:
  1. { code: 6500, message: 'General Error' }
It appears that this line in my code:
  1. 'Content-Type': 'multipart/form-data'
is causing the error. When I remove that line, the comment content is submitted correctly, however no file is uploaded.

Any ideas as to what I may be doing wrong?

Thanks

    • Sticky Posts

    • Announcing the Zoho Projects API

      Today we're excited to announce the API for Zoho Projects where any developer can extend the project management and collaboration capabilities through our APIs and can build their own customized applications for their business needs. We've tried to make the API follow the REST (Representational State Transfer) principles and generate a XML/ JSON object which allows you to access / read / write Zoho Projects data from third-party systems like Google/Yahoo gadgets, web sites, billing & invoicing systems,
    • Have you moved to REST API?

      Dear API Users, The Documentation of our Rest API is available here . All future development will be done to this version. We are deprecating the older API today. Its documentation will no longer be available and we will also be stopping the calls to this API soon. Thanks, Prasanna

      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.

                                                                  有料プランをご利用の方