Skip to main content
Answered

Query for null or not null

  • June 15, 2023
  • 1 reply
  • 261 views

url = "https://api.intercom.io/conversations/search"

headers = {

'Accept': 'application/json',

'Authorization': 'Bearer auth-token',

"Intercom-Version": "2.9",

"Content-Type": "application/json"

}

params = {

  "query": { "operator": "AND", "value": [ { "field": "team_assignee_id", "operator": "!=", "value": None}]}

}

response = requests.post(url, headers=headers, json=params)

 

I want to get all assigned conversation and I have only one conversation and it’s team_assignee_id value is null. This query should return an empty list, but it is returning that conversation. What is the correct setup to get only assigned conversations? Also, for whatever reason, the equal(β€œ=”) operator returns the same result. 

"query": {"field": "team_assignee_id","operator": "=","value": None}
This query using equals and not equals return an empty list.

Best answer by Ted Martinez

I figured it out. You gotta use an empty string instead of None. This returns all the assigned conversations. 
"query": { "operator": "AND", "value": [ { "field": "team_assignee_id", "operator": "!=", "value": ''}]}

View original
Did this topic help you find an answer to your question?

1 reply

  • Author
  • New Participant
  • 1 reply
  • Answer
  • June 15, 2023

I figured it out. You gotta use an empty string instead of None. This returns all the assigned conversations. 
"query": { "operator": "AND", "value": [ { "field": "team_assignee_id", "operator": "!=", "value": ''}]}


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings