Skip to main content
Solved

Unable to get the filtered data by api

  • July 17, 2023
  • 1 reply
  • 75 views

Hello everyone,

I am using customer io post customers api to get the users from customer io and also adding the filters to get the relevent data that matches the conditions in the filtere, but it seems to be not working.

here is the snippet of code I am using to get the data

    url = "https://api-eu.customer.io/v1/customers"
    payload = {
        "filter": {
            "and": [
                {"attribute": {"field": "email", "operator": "exists", "value": False}}
            ]
        }
    }

I want users who don’t have the email attribute in their user attributes, but I am getting users with email attributes, means the filter is not working.

would appreciate the help from the community here.

Thanks

Best answer by Byron

Hi there,

 

Byron here from the technical support team. Great question!

 

Our getPeopleFilter endpoint includes a not filter that accepts a single object as a way to return matches that do not match the object filter.

https://customer.io/docs/api/app/?region=eu#operation/getPeopleFilter

 

To return a list of people who do not have an email attribute, try this:

```

{
  "filter": {
    "not": 
      {
        "attribute": {
          "field": "email",
          "operator": "exists"
        }
      }
    
  }
}

```

 

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

Byron
  • July 17, 2023

Hi there,

 

Byron here from the technical support team. Great question!

 

Our getPeopleFilter endpoint includes a not filter that accepts a single object as a way to return matches that do not match the object filter.

https://customer.io/docs/api/app/?region=eu#operation/getPeopleFilter

 

To return a list of people who do not have an email attribute, try this:

```

{
  "filter": {
    "not": 
      {
        "attribute": {
          "field": "email",
          "operator": "exists"
        }
      }
    
  }
}

```

 


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