Answered

Error response when invoking contact search API

  • 17 March 2021
  • 5 replies
  • 241 views

When I invoke the contact search API, I get the following error response.

 

{

"type": "error.list",

"request_id": "0009s379b118psj1f100",

"errors": [

{

"code": "invalid_document",

"message": "either_email_or_user_id_present validation failed"

}

]

}

 

Does anyone know what has gone wrong here?

icon

Best answer by Eric Fitz 23 March 2021, 16:57

View original

5 replies

Userlevel 1

Hey @rushmin​, could you provide me with an example of an API call that you made which returned this error, please?

Hi @eric f11​ thank you for the response. I tried various combinations. Below is one of them.

 

curl --location --request POST 'https://api.intercom.io/contacts#39; \

--header 'Accept: application/json' \

--header 'Authorization: Bearer xxxxxxxxxxx' \

--header 'Content-Type: application/json' \

--data-raw '{

"query": {

"operator": "AND",

"value": [

{

"operator": "OR",

"value": [

{

"field": "created_at",

"operator": ">",

"value": 1560436650

},

{

"field": "signed_up_at",

"operator": ">",

"value": 1560436784

}

]

},

{

"operator": "OR",

"value": [

{

"field": "custom_attributes.salseforce_status",

"operator": "~",

"value": "Open"

},

{

"field": "custom_attributes.salesforce_object_type",

"operator": "=",

"value": "Lead"

}

]

}

]

}

}'

Userlevel 1

Looks like you're sending that POST to https://api.intercom.io/contacts which will try and create a contact.

 

You can send the POST to https://api.intercom.io/contacts/searchto hit the contact search endpoint.

Thanks a lot, Eric. That was the issue. I have missed the endpoint in the documentation. Sorry for the trouble.

Userlevel 1

No trouble at all, @rushmin​! I'm glad we could get this resolved for you 🙌

Reply