Filtering doesnt seem to work on a newer Intune\Ap graph endpoint.

Anonymous
2021-03-31T18:36:43.073+00:00

I cannot seem to get filter\select to work.

can you tell me if they are supported on this endpoint?

What I am trying to do is query for a specific serial, or userprincipalname. As it stands today I have to get the initial 1k devices then page through for the rest, then do client side filtering to extract the machine I want. I would rather be able to filter api side and send over a specific serial or UPN to check to see if there is a corresponding device.

So for example something like this:

https://graph.microsoft.com/beta/xxx/deviceManagement/windowsAutopilotDeviceIdentities?$filter=serialNumber eq 82NAAA

I also tried with quotes:

https://graph.microsoft.com/beta/xxx/deviceManagement/windowsAutopilotDeviceIdentities?$filter=serialNumber eq '82NAAA'

also tried with an escape on the $ in filter which sometimes will mess up a web call:

https://graph.microsoft.com/beta/xxx/deviceManagement/windowsAutopilotDeviceIdentities?`$filter=serialNumber eq 82NAAA

All of the above fail with error 400 bad requests.

Microsoft Security | Windows Autopilot
Microsoft Security | Intune | Other
0 comments No comments
{count} votes

Answer accepted by question author
  1. Dave Randall 86 Reputation points Microsoft Employee
    2021-03-31T18:55:57.177+00:00

    Hey Lou... :)

    $filter=contains(serialNumber,'011138765157')

    is the right way to do this.

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Dave Randall 86 Reputation points Microsoft Employee
    2023-03-09T15:35:06.01+00:00

    I spoke with the developer for that feature, and they said that contains was the only supported filter option. eq wasn't supported. I hear you Søren that there may be conditions where that would result in multiple returned objects, but currently the code doesn't implement the eq condition.

    Dave


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.