Skip to main content

I am trying to fetch 150  contacts per page while calling  https://api.intercom.io/contacts.

but on trying to do so , i am getting the following error 

{"type":"error.list","request_id":"0069rm2ubh0lgdfr7kg0","errors":r{"code":"invalid_document","message":"either_email_or_user_id_present validation failed"}]}

 

attaching the REST API INTEGRTION code below: ( implemented using Salesforce Apex)

 

String endpoint=’ https://api.intercom.io/contacts

HttpRequest request = new HttpRequest();
 request.setEndpoint(endpoint);
 request.setMethod('GET');
 request.setHeader('Authorization', 'Bearer ' + INTERCOM_API_TOKEN);
 request.setHeader('Accept', 'application/json');
 request.setHeader('Content-Type','application/Json');
      
 Integer perPage = 150; 
 String json= '{'+            
            ' "per_page":'+perPage + 
  '}'; 
  system.debug(json);

 request.setBody(json);

 

Could you kindly share your thoughts on how to handle this error . Any input is highly appreciated .

 

Thank you 

Hi @habraham_martellotech.com ! Ebenezer here from Engineering Support👋.

I see a something small that may be the issue.

Could you change; request.setHeader('Content-Type','application/Json'); to request.setHeader('Content-Type','application/json');

Let me know how it goes!


Thanks it worked


Reply