Vue API children Search

Hi there,

I want to add some filters to my api call in a custom section for the panel in a vue component:

let filters = [{
   status: 'draft'
}];

let params = {
  search: 'some search Term',
  paginate: paginate,
  filterBy: filters
};

this.$api.post(this.parent+'/children/search',params).then(response => {
   console.log(response);
});

But I could not get the filterBy settings right. Pagination is working, even search terms. Can you give me a hint, how to set the filters array right (even for multiple filters). There are many explanations about php usage but not about Vue / JS filter settings.

The Reference just states “array of filters” /api/pages/:id/children/search

Thanks for your help in advance!

Patrick

The filter array has to look something like this it seems:

	"filterBy": [
		{
			"field": "somefield",
			"value": ["a","b"],
			"operator": "in"
		}
	]

Since children doesn’t return drafts, I don’t think your filter will work.

2 Likes

Thanks for the reply! This will help :wink:

I ended up creating a custom api endpoint with a collection.