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>


      Zoho Campaigns Resources


        • Desk Community Learning Series


        • Digest


        • Functions


        • Meetups


        • Kbase


        • Resources


        • Glossary


        • Desk Marketplace


        • MVP Corner


        • Word of the Day


        • Ask the Experts


          Zoho CRM Plus Resources

            Zoho Books Resources


              Zoho Subscriptions Resources

                Zoho Projects Resources


                  Zoho Sprints Resources


                    Zoho Orchestly Resources


                      Zoho Creator Resources


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




                            Zoho Writer Writer

                            Get Started. Write Away!

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

                              Zoho CRM コンテンツ



                                ご検討中の方