+ Start a Discussion
vijay jillella 9vijay jillella 9 

kinldy help want a post a job in indeed job board ,kindly help with the below code

public class IndeedTestervijay {  
   // String jobXML{get;set;}       
     public void createAndSendJob()         
    {
       String access_token = '9999e3bb3112cfa022da0f864850d13c8a9387d6f336830b5d74c7bff67d7499';
       String xmlBody = 'indeed-apply-jobUrl="http://Jill-Gaba.SFAgentJobs.com/j/0b0yx"&indeed-apply-jobId="514473"&indeed-apply-jobTitle="Account Associate - State Farm Agent Team Member"&indeed-apply-jobCompanyName="Jill Gaba - State Farm Agent"&indeed-apply-jobLocation="Macedonia, OH 44056" &indeed-apply-apiToken="9999e3bb3112cfa022da0f864850d13c8a9387d6f336830b5d74c7bff67d7499"&indeed-apply-postUrl="http://app.careerplug.com/jobs/1928/apps.json"&indeed-apply-phone="required"&indeed-apply-questions="http://app.careerplug.com/jobs/1928/questions.json"&indeed-apply-continueUrl="http://ProsigoExecutiveSearch.hiringhook.com/JobSeeker/Thank_You.aspx?jobid=02168140"&indeed-apply-jobMeta="?jid=02168140 and siteid=1342 and mobile=0"&indeed-apply-name="firstlastname"';
       XmlStreamWriter w = new XmlStreamWriter();
       w.writeStartDocument('utf-8', '1.0');        
       w.writeStartElement(null, 'indeed-apply-data', null);
       w.writeCData(xmlBody); 
       w.writeEndElement(); 
       w.writeEndDocument();
       String xmlOutput = w.getXmlString();
    //   jobXML = w.getXmlString();
       w.close();
     //  system.debug('-------------------------jobXML ' +jobXML);       
       system.debug('---------------------------xmlOutput'+xmlOutput);
       system.debug('-----------------------xmlBody'+xmlBody);
        http ht = new http();
        HttpRequest request=new HttpRequest(); 
        request.setEndpoint('https://app.careerplug.com/jobs/1928/application/json');   
        request.setMethod('POST');
        request.setHeader('Content-Type', 'text/xml;charset=UTF-8');
        //request.setHeader('Authorization','OAuth '+access_token);
        request.setBody(xmlOutput);
        HttpResponse response=ht.send(request);
        //string finalResultPOST=response.getBody();
      
        system.debug('---------------------------Response From Indeed-------------'+response.getBody()); 
        system.debug('----------+++++++++-----------------Response From Indeed-------------'+response.getXmlStreamReader());
      system.debug('---------------------------Response From Indeed-------------'+response.getHeaderKeys());
        system.debug('---------------------------Response From Indeed-------------'+response.getHeader('access_token'));
    }   
    }
Tiago Armando CoelhoTiago Armando Coelho
Hi, 

In order to, we can help you can you please detail what is the problem with the above code?

Kind regards,