Art
Art

Reputation: 227

Rest api filter by field equals null in Angular

I got an Angular app that connects to a REST API (in C#).

I am trying to send a filter to the GetAll endPoint, so that I get all the elements of a certain type in a table, except those that have a null category.

I have tried this:

let filter = (type eq 'A')`;
filter += ` and (categoryId eq '$NULL')`;

But while this works perfectly, the above code it returns zero results.

let filter = (type eq 'A')`;

So I guess the syntax I found in internet for filtering nulls in rest is not correct (or I am applying it wrong), or it maybe that null filtering is not supported?

Upvotes: 0

Views: 426

Answers (1)

user2250152
user2250152

Reputation: 20725

It's not clear how do you call the Rest API but the filter query to return data without category should look like

let filter = `type eq 'A' and categoryId eq null`;

Upvotes: 1

Related Questions