Azure / Azure/azure-rest-api-specs

Invalid filter expression in DataSourcesListByWorkspace

Open
#22,756 1 comment 0 reactions 0 assignees View on GitHub
Operational Insights Service Attention
Dominant language
TypeSpec
Stars
3.1k
Forks
5.9k
Avg merge
2d 22h
Merged PRs (30d)
444

Description

Ref:

https://github.com/Azure/azure-rest-api-specs/blob/main/specification/operationalinsights/resource-manager/Microsoft.OperationalInsights/stable/2020-08-01/examples/DataSourcesListByWorkspace.json

"$filter": "kind='WindowsEvent'",

This is not valid. I make the call with AZ REST (for the sake of simplicity):

https://management.azure.com/subscriptions/e36582a6-9e0c-4644-9b78-592ffe29a705/resourcegroups/defaultresourcegroup-eus/providers/Microsoft.OperationalInsights/workspaces/Workspace-be596052-ca5c-4643-a5c0-c3aae3e7a
f13-EUS/dataSources?$filter=kind='LinuxPerformanceObject'&api-version=2020-08-01

And what I get back is:

az : ERROR: Bad Request({"error":{"code":"KindNotSpecified","message":"Must specify a valid kind filter. For example, $filter=kind eq 'windowsPerformanceCounter'."}})

I Oblige the error message and switch to 'eq' and it goes well:

https://management.azure.com/subscriptions/e36582a6-9e0c-4644-9b78-592ffe29a705/resourcegroups/defaultresourcegroup-eus/providers/Microsoft.OperationalInsights/workspaces/Workspace-be596052-ca5c-4643-a5c0-c3aae3e7a
f13-EUS/dataSources?$filter=kind eq 'LinuxPerformanceObject'&api-version=2020-08-01

I was sent on this wrong path by our official documentation, which is apparently based off the aforementioned API definition file:

https://learn.microsoft.com/en-us/rest/api/loganalytics/data-sources/list-by-workspace?tabs=HTTP

Contributor guide

Open the contributing guide

Research direction

Start with specification/operationalinsights/resource-manager/Microsoft.OperationalInsights/stable/2020-08-01/examples/DataSourcesListByWorkspace.json and compare its $filter syntax with the error message and working request in the issue. Update the example so it uses the accepted expression, then verify the linked REST documentation reflects the corrected example.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi
Domain
api
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.