Azure / Azure/azure-rest-api-specs

ApplicationInsights analticsItem@2015-05-01 List returns 400 error without response message

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

Description

## Description
In swagger: https://github.com/Azure/azure-rest-api-specs/blob/bc6b52f26f09cfc7085a8d5df109b54ba00843cc/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/analyticsItems_API.json#L36-L41
https://github.com/Azure/azure-rest-api-specs/blob/bc6b52f26f09cfc7085a8d5df109b54ba00843cc/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/analyticsItems_API.json#L294-L326
`{scopePath}=myanalyticsItems` should match `"Scope":"user"` in body of PUT or in query of GET, `{scopePath}=analyticsItems` should match `"Scope":"shared"`.

But the {scopePath} in path of List method does not match the one used in PUT method. I use `{scopePath}=myanalyticsItems` and `"Scope":"user"` in PUT, but have to use `{scopePath}=analyticsItems` and `scope=user` in GET.

## API detail
### 1. PUT a analyticsItem (`myanalyticsItems` in path, `"Scope": "user"` in body)
```
PUT https://management.azure.com/subscriptions/{{subscriptionId}}/resourceGroups/wt-test-ag/providers/Microsoft.Insights/components/tf-test-appinsights/myanalyticsItems/item?api-version=2015-05-01
{
"Scope": "user",
"Type": "query",
"Name": "atestAnalyticsItem",
"Content": "requests #test"
}
```
```
Status: 200 OK

{
"Scope": "user",
"Type": "query",
"Name": "atestAnalyticsItem",
"Id": "fa4a10a5-8d42-47dd-88d0-03ba182f90f3",
"Content": "requests #test",
"TimeModified": "2022-09-14T05:30:28.7749976Z",
"TimeCreated": "2022-09-14T05:30:28.7749976Z",
"Version": "1.0"
}
```
x-ms-request-id: 4a2597a0-a7f9-46f1-9f24-dd19181c52a1
x-ms-correlation-request-id: 4a2597a0-a7f9-46f1-9f24-dd19181c52a1

### 2. GET analyticsItems (`myanalyticsItems` in path, `scope=user` in query)
```
GET https://management.azure.com/subscriptions/{{subscriptionId}}/resourceGroups/wt-test-ag/providers/Microsoft.Insights/components/tf-test-appinsights/myanalyticsItems?api-version=2015-05-01&scope=user&type=query
```
```
Status: 400 Bad Request

response message is empty
```
x-ms-request-id: b039ac80-1154-4608-ba65-98a16fe9a932
x-ms-correlation-request-id: b039ac80-1154-4608-ba65-98a16fe9a932

### 3. GET analyticsItems (`analyticsItems` in path, `scope=user` in query)
```
GET https://management.azure.com/subscriptions/{{subscriptionId}}/resourceGroups/wt-test-ag/providers/Microsoft.Insights/components/tf-test-appinsights/analyticsItems?api-version=2015-05-01&scope=user&type=query
```
```
Status: 200 OK

[
{
"Scope": "user",
"Type": "query",
"Name": "atestAnalyticsItem",
"Id": "fa4a10a5-8d42-47dd-88d0-03ba182f90f3",
"Content": null,
"TimeModified": "2022-09-14T05:30:28.7749976Z",
"TimeCreated": "2022-09-14T05:30:28.7749976Z",
"Version": "1.0"
}
]
```
x-ms-request-id: 0b09dbd8-bc79-4503-9800-44e365469568
x-ms-correlation-request-id: 0b09dbd8-bc79-4503-9800-44e365469568

Contributor guide

Open the contributing guide

Research direction

Start with the referenced analyticsItems_API.json sections at lines 36-41 and 294-326, then compare the List and PUT path templates and scope parameters. Reproduce the three documented requests and verify that the specification's paths and parameters consistently describe the observed API behavior, including the 400 response case.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.