How to use uploadFile - solution

How to use uploadFile - solution

Hi, I've spent a whole day trying to setup the API call for uploadFile and once I figured it out I would like to share how to do it.

In my case I wanted to send a CV as an attachment to a Candidate profile in Zoho Recruit through the API. I'm attaching screenshots from Postman:


As you can see everything here is the same as in the docs, except for the URL beginning (in my region I use recruit.zoho.eu for you guys it may be .com). I'm also NOT putting the "content" parameter in the URL.

Now here comes the interesting part:


Here is where content goes. In the body as form-data. The type of the key "content" is "file", not "text" (you can select it when you hover over the key).

After submitting this request the file is attached and you can see the response being successful.
In Postman you can export this request in many popular coding languages, just bear in mind that the code will assume that you're using a local file, so you might have to make changes for files from URL's.

Here's an example Python implementation that grabs files from URL's:


  1. from urllib.request import urlopen
    import requests

    def
    upload_cv(candidate):

    url = "https://recruit.zoho.eu/recruit/private/xml/Candidates/uploadFile?"
    params = {
    "authtoken": <Your Token>,
    "scope": "recruitapi",
    "id": <The id of the record you want to file to be attached to>,
    "type": "Others" //<this is not set in stone check your attachment types>,
    "version": 2,
    }

    files = [
    ('content', urlopen("the url of your file").read())
    ]

    r = requests.post(url, params, files=files)

And now I would like to rant a bit. Why cannot I find this information above in the docs? Why are the docs misleading me into using content as a URI parameter which doesn't work at all? Why are there so many tickets in the forum with this exact same problem for the past 8 years and most of them are not solved in a meaningful way?

Come on guys :/






                            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