Azure / Azure/azure-rest-api-specs
MachineLearningService Workspaces_CreateOrUpdate is not long-running-operation but the rest api will return 202 with async polling URL
- Dominant language
- TypeSpec
- Stars
- 3.1k
- Forks
- 5.9k
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 424
Description
Currently the swagger definition does not mark the operation `Workspaces_CreateOrUpdate` as `"x-ms-long-running-operation": true`, therefore this method is now synchronous.
But when I call this rest api using PostMan or from rest api doc ([here](https://docs.microsoft.com/en-us/rest/api/azureml/workspacesandcomputes/workspaces/createorupdate#code-try-0)), the rest api will return 202 as status code, with a header of “location” and a polling URL. This is the behavior of an asynchronous operation.
*Request*
```
PUT https://management.azure.com/subscriptions/{subsID}/resourceGroups/dapzhang0002-eastus2/providers/Microsoft.MachineLearningServices/workspaces/workspace0002?api-version=2019-11-01
```
Body:
```
{
"location": "eastus2",
"properties": {
"friendlyName": "HelloName",
"description": "test description",
"keyVault": "/subscriptions/{subsID}/resourceGroups/dapzhang0002-eastus2/providers/Microsoft.KeyVault/vaults/dapzhang0002-vault",
"applicationInsights": "/subscriptions/{subsID}/resourceGroups/dapzhang0002-eastus2/providers/microsoft.insights/components/dapzhang0002-ai",
"storageAccount": "/subscriptions/{subsID}/resourceGroups/dapzhang0002-eastus2/providers/Microsoft.Storage/storageAccounts/dapzhang0002sa"
},
"identity": {
"type": "SystemAssigned"
}
}
```
*Response*
Header:
```
cache-control: no-cache
content-length: 0
date: Tue, 24 Dec 2019 08:53:04 GMT
expires: -1
location: https://management.azure.com/subscriptions/{subsID}/providers/Microsoft.MachineLearningServices/locations/eastus2/workspaceOperationsStatus/6f7393d7-b774-433e-bb86-d888a850313e?api-version=2018-03-01-preview
pragma: no-cache
request-context: appId=
strict-transport-security: max-age=31536000; includeSubDomains
x-ms-client-request-id:
x-ms-client-session-id:
x-ms-correlation-request-id: 671465bb-b429-41ce-a8dc-6177089c32e9
x-ms-ratelimit-remaining-subscription-writes: 1198
x-ms-request-id: 671465bb-b429-41ce-a8dc-6177089c32e9
x-ms-routing-request-id: SOUTHEASTASIA:20191224T085304Z:671465bb-b429-41ce-a8dc-6177089c32e9
```
No body.
Contributor guide
Research direction
Locate the MachineLearningService operation Workspaces_CreateOrUpdate in the REST specification and inspect how its response is modeled. Confirm the service returns HTTP 202 with a Location polling URL, then update the operation metadata so the generated client treats it as long-running and verify the specification with the repository's validation or generation checks.
Written by the indexing model from the issue text.
Assessment
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100