Getting error code null when adding record

Getting error code null when adding record


Hi,

I am try to add candidate record from WordPress but getting error. This is the code that i have written please help me what am i doing wrong.

function get_fields_by_ajax_callback() {
check_ajax_referer('get_fields','security');
$firstname= $_REQUEST['firstname'];
$lastname= $_REQUEST['lastname'];
$email = $_REQUEST['email'];
$phone = $_REQUEST['phone'];
$nationality = $_REQUEST['nationality'];
$age = $_REQUEST['age'];
$location = $_REQUEST['location'];
$languages = $_REQUEST['languages'];
$gender = $_REQUEST['gender'];
$current_employer = $_REQUEST['current_employer'];
$Current_job_title = $_REQUEST['Current_job_title'];
$qualification = $_REQUEST['qualification'];
$last_emp_details = $_REQUEST['last_emp_details'];
$function1 = $_REQUEST['function1'];
$industry = $_REQUEST['industry'];
$salary  = $_REQUEST['salary'];
        $experience = $_REQUEST['experience'];

$xml='
<Candidates>
<row no="1">
<FL val="First name">'.$firstname.'</FL>
<FL val="Last name">'.$lastname.'</FL>
<FL val="Email ID">'.$email.'</FL>
<FL val="Contact number">'.$phone.'</FL>
<FL val="Total work exp">'.$experience.'</FL>
<FL val="Current job title">'.$Current_job_title.'</FL>
<FL val="Current employer">'.$current_employer.'</FL>
</row>
</Candidates>'
;

//echo $url;

include_once( ABSPATH . WPINC. '/class-http.php' );    
    $request = new WP_Http;
    $result = $request->request( $url1, array( 'method' => 'POST', 'body' => $xml) );
if($result){ echo "updated";}else{echo "not updated";}


wp_die();
 }


Also getting error when i make an api request to addrecords using postman.

            Parameters passed authtoken=api-key
                                             scope=recruitapi
                                             duplicateCheck=1
                                              version=4
with a header content-type= text/xml and request body
<Candidates> <row no="1"> <FL val="First name">Satvik</FL> <FL val="Last name">Kothandaraman</FL> <FL val="Contact address">my home</FL> <FL val="Email ID">satvik@advent.com</FL> <FL val="Contact number">44987654</FL> <FL val="Total work exp (year)">5</FL> <FL val="Total work exp (month)">5</FL> <FL val="Current job title">SE</FL> <FL val="Skill set">Java</FL> </row> </Candidates>

API response

<?xml version="1.0" encoding="UTF-8" ?> <response uri="/recruit/private/xml/Candidates/addRecords"> <error> <code>null</code> <message>null</message> </error> </response>

    Access your files securely from anywhere







                            Zoho Developer Community





                                                  Use cases

                                                  Make the most of Zoho Desk with the use cases.

                                                   
                                                    

                                                  eBooks

                                                  Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho Desk.

                                                   
                                                    

                                                  Videos

                                                  Watch comprehensive videos on features and other important topics that will help you master Zoho Desk.

                                                   
                                                    

                                                  Webinar

                                                  Sign up for our webinars and learn the Zoho Desk basics, from customization to automation and more

                                                   
                                                    
                                                  • Desk Community Learning Series


                                                  • Meetups


                                                  • Ask the Experts


                                                  • Kbase


                                                  • Resources


                                                  • Glossary


                                                  • Desk Marketplace


                                                  • MVP Corner






                                                            Manage your brands on social media



                                                                  Zoho TeamInbox Resources



                                                                      Zoho CRM Plus Resources

                                                                        Zoho Books Resources


                                                                          Zoho Subscriptions Resources

                                                                            Zoho Projects Resources


                                                                              Zoho Sprints Resources


                                                                                Qntrl Resources


                                                                                  Zoho Creator 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


                                                                                            Zoho Show Resources


                                                                                              Zoho Writer Writer

                                                                                              Get Started. Write Away!

                                                                                              Writer is a powerful online word processor, designed for collaborative work.

                                                                                                Zoho CRM コンテンツ








                                                                                                  Nederlandse Hulpbronnen


                                                                                                      ご検討中の方