Skip to main content
Skip table of contents

Why do I get a 422 error 'filters must be an array' in the API?

Firstly, ensure you have checked against our documentation for the endpoint that you are using, and that you have used the correct IDs (affiliate ID / campaign ID respectively where required in the API).

If you are receiving an error similar to the below when using filters in one of our Publisher Platform API endpoints:

422 error: "The attribute filters.networks must be an array."

In this case, the filter should be like;

filters[networks][]=8

(i.e. not like filters[networks]=[8])

Additional examples for correctly formatting adding a query parameter:

https://platform-api.webgains.com/auth/publishers/XXXX/campaigns/XXXX/feeds/products/?filters[feedIds][]=XXXX&filters[feedIds][]=XXXX

 

Reporting API with filtering:

?filters[campaign_ids][]=123

So it is equivalent to:

CODE
filters: {
  campaign_ids: [123],
}

With multiple filters, it would be like:

filters[campaign_ids][]=1068&filters[campaign_ids][]=1097

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.