Skip to Content
0

Posting of requisition on naukri.com from eRecruitment

Nov 17, 2017 at 12:50 PM

22

avatar image
Former Member

As per requirement, we want to publish requisition created through eRecruitment on naukri.com (job portal).

We are able to publish requisition using postman (google ad-on). But when we tried to post the same using eRecruitment using ABAP code we are getting an error.

I have attached the code and error for your reference.

""""""""""""SAP to API Integration""""""""""""""""""




""""""JSON Code
"""Sample Code


CONCATENATE '{"requirementName": "test1236","title": "test1236","description": "Test Job Description","candidateProfile": "Test Candidate profile","salary": { "currency": "USD", "min": 80000, "max": 80000, "showToJobseeker": 1 },'
'"otherSalary": "Other Salary Details","experience": { "min": 5, "max": 6 },"keywords": ["java", "Test"],"locations": { "cityIds": ["258"], "otherCity": ["Test"], "countryIds": [{ "id": "180", "city": "Test" },{ "id": "180" }],"otherCountry": ["Test"]},'
'"createdBy": "Test User","industry": 8,"functionalArea": 1,"role": "1.1","hiringFor": { "name": "Test Employer", "showToJobseeker": 1 } ,"visibilty": { "visibleTo": 1, "userNames": ["Test Sub User"] } ,"sendNotificationMail": 1,"vacancies": 2,'
'"referralCode": "123","ug": { "type": 1, "courseIds": ["2"], "specIds": ["2.0"], "relation": 0 } ,"pg": { "type": 1, "courseIds": ["2"], "specIds": ["2.0"], "relation": 1 },"ppg": { "type": 1, "courseIds": ["2"], "specIds": ["2.1"] },'
'"questionnaireName": "Test Questionnaire","contact": { "person": "dasafdssd", "number": "8989898989", "companyWebsite": "http://www.xyz.com", "aboutCompany": "xyzHello", "showToJobseeker": 1 }}' into gv_json.




******API Integration
""""POST API for Naukri.com


"""Declaration as per data provided by Naukri.com
    gv_url  = 'https://rms.naukri.com/v1/recruiterApi/requirements/ZfMd9'.


  CALL METHOD cl_http_client=>create_by_url
    EXPORTING
      url                = gv_url
    IMPORTING
      client             = lo_http_client
    EXCEPTIONS
     argument_not_found = 1
     plugin_not_active  = 2
     internal_error     = 3
     OTHERS             = 4.
    IF sy-subrc <> 0.
     ENDIF.


   clear : gv_length.


   gv_length  = strlen( gv_json ).


*****Set the Data
****
  " Pass Login Parameters - Start
  CALL METHOD lo_http_client->request->set_header_field         ""P
     EXPORTING
       name = 'authorization'
       value = 'Basic YXBwa2V5OjIzMTJjOWEwYWU5OGRlMjA4NzIxZTM2OWYzNjYxZTNjNmFiOTcwN2VlZTI4OTA4MTM1NWQ2MDczOGUzZmMzZTU='.


CALL METHOD lo_http_client->request->set_header_field
     EXPORTING
        name  = '~request_method'
        value = 'POST'.




   CALL METHOD lo_http_client->request->set_header_field                  """"p
      EXPORTING
        name  = 'Accept-Encoding'
        value = 'gzip,deflate'.


  CALL METHOD lo_http_client->request->set_header_field
     EXPORTING
       name  = 'Content-Type'
       value = 'application/json'. 


  CALL METHOD lo_http_client->request->set_header_field
     EXPORTING
       name  = 'Accept'
       value = 'application/json, application/xml'."


****v
   CALL METHOD lo_http_client->request->set_cdata
     EXPORTING
       data   = gv_json
       offset = 0
       length = gv_length.




****Make the call


   lo_http_client->send(
     EXCEPTIONS
       http_communication_failure = 1
       http_invalid_state         = 2 ).


****Receive the Response Object


   lo_http_client->receive(
     EXCEPTIONS
       http_communication_failure = 1
       http_invalid_state         = 2
       http_processing_failed     = 3 ).


***Get the response content in Character format
****
lv_http_status = lo_http_client->response->get_header_field('~status_code').
****
   CLEAR lv_result .


   lv_result = lo_http_client->response->get_cdata( ).


   WRITE:lv_result.





ERROR from above code -

ERROR - <?xml version="1.0" encoding="UTF-8"?>#<response># <error># <status>415</status># <message>Unsupported Media Type</message># </error>#</response>#

Thanks

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

0 Answers