Cannot create ticket in API, INVALID_DATA error returned against valid json.

Cannot create ticket in API, INVALID_DATA error returned against valid json.

Hi,

I'm trying to use the API to create a ticker, and I and getting an unusual error back when I post up data to create a ticket.

I have called the API endpoint to list the departments, and I am taking the id field from one of the ones listed and putting it as the departmentId in the following object that is being sent up.
  1. {
  2.   "subject": "Posted from Web API",
  3.   "departmentId": "00000000000000000", //Removed actual value
  4.   "description": "I was created by the Web API!",
  5.   "contact": {
  6.     "firstName": "First",
  7.     "lastName": "Last",
  8.     "email": "ValidEmailAddressHere",
  9.     "phone": "01234567890",
  10.     "cf": null
  11.   },
  12.   "productId": null,
  13.   "email": "ValidEmailAddressHere",
  14.   "phone": "01234567890",
  15.   "cf": null
  16. }

When I post this up I get the following error back


  1. {"errorCode":"INVALID_DATA","message":"The data is invalid due to validation restrictions","errors":[{"fieldName":"/departmentId","errorType":"invalid","errorMessage":""}]}

I am not escaping the names of the parameters, I am using Newtonsoft.Json to serialize and RestSharp to make these requests so they are generating a valid json body for the request that appears correctly in any of the debug inspectors, so I'm not sure why it is being rejected, so I'm unsure where the issue is coming from, I am not using any specialized serializers or anything like that, I have a couple of C# POCO classes that reflect the structure defined in the API docs at https://desk.zoho.com/support/APIDocument.do#Tickets and https://desk.zoho.com/support/APIDocument.do#Contacts and I have tests to show that they serialize to json that matches the samples in the docs. Is there a specific approach preferred when calling the API from .Net code, should I need a custom serializer or tweak the default serialization settings?


Thanks for any help.

    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