Create Filter (counting)

let storageId = 123
let filter = {
  name:"my first filter",
  type :"SEGMENT",
  dimension_indexes:[1], // add column index 1 (postal code in example) in the stats file
  column_filter:[ // filter on column value
    {
    column_index:1, // index 1, postal code in example
    values:["54","67","57","68"], // postal code must start with this values
    operator:"PREFIX" // indicate type of filter: EQUAL,PREFIX etc, see reference
    not:false // if true reverse the condition (here, must not start with selected values)
    }
  ]
  segment_filter:{
    segment: [{id:456}, {id:789}], // count for hash in segment 456 or 789
  }
}
fetch("https://gateway.sirdata.io/api/v1/public/customer/storage/"+storageId+"/filter?=", {
  "method": "POST",
  "headers": {
    "Content-Type": "application/json",
    "x-api-token": "XXXXX-XXXXX-XXXXX-XXXXX",
  },
  "body": JSON.stringify(filter)
})
.then(response => {
  console.log(response);
})
.catch(err => {
  console.error(err);
});

If response status code is 202 then proceed to get filter object each x seconds to check status until ERROR or OK

Get filter segments stats

Reference: https://openapi.sirdata.io/customer/#tag/filter/paths/~1customer~1storage~1{id}~1filter~1{filterId}~1counting/get

Example of CSV stats

Last updated

Was this helpful?