Azure / Azure/azure-rest-api-specs-examples

[Open AI] Rai Blocklist Item API Get - 400 Bad Request

Open
#5,409 0 comments 0 reactions 1 assignee Claimed by @JiaqiZhang-Dev View on GitHub
Dominant language
No language data
Stars
40
Forks
23
Avg merge
23h 36m
Merged PRs (30d)
172

Description

### Link to sample

[https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName}?api-version=2024-10-01](https://learn.microsoft.com/en-us/rest/api/aiservices/accountmanagement/rai-blocklist-items/get?view=rest-aiservices-accountmanagement-2024-10-01&tabs=HTTP)

### Library name and version

github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cognitiveservices/armcognitiveservices - v1.7.0

### Language of the Sample

- [ ] C#/.NET
- [ ] Java
- [ ] JavaScript/TypedScript
- [ ] Python
- [x] Golang
- [x] Other - Please specify in Issue details field

### Sample Issue Type

- [x] Sample not working
- [ ] Sample missing
- [ ] Do not understand sample

### Issue details

Rai Blocklist Item that supports Azure OpenAI Content Filter has APIs to List, CreateOrUpdate, Get and so on. Rai Blocklist Item Get ([link](https://learn.microsoft.com/en-us/rest/api/aiservices/accountmanagement/rai-blocklist-items/get?view=rest-aiservices-accountmanagement-2024-10-01&tabs=HTTP)) which passes parameters such as `subscriptionId`, `resourceGroupName`, `accountName`, `raiBlocklistName` and `raiBlocklistItemName`. The response should be the properties of the Rai Blocklist Item such as `isRegex` and `pattern`. The point is when calling the API using Postman or even directly in this [link](https://learn.microsoft.com/en-us/rest/api/aiservices/accountmanagement/rai-blocklist-items/get?view=rest-aiservices-accountmanagement-2024-10-01&tabs=HTTP) and you can hit (Try it), or using `azure-sdk-for-go`, the response is always `400 Bad Request`. If I provide a wrong Rai Blocklist Item Name, the expected response should be `404 Not Found` but again the response is `400 Bad Request`. This is not the expected behavior of the API.

Here is error using `azure-sdk-for-go`:

```
2024/12/30 15:28:31 failed to finish the request: GET https://management.azure.com/subscriptions//resourceGroups//providers/Microsoft.CognitiveServices/accounts//raiBlocklists//raiBlocklistItems/
--------------------------------------------------------------------------------
RESPONSE 400: 400 Bad Request
ERROR CODE UNAVAILABLE
--------------------------------------------------------------------------------
Response contained no body
--------------------------------------------------------------------------------
exit status 1
```

### Expected behavior

The expected behavior is if the rai blocklist name is not found it should be `404 Not Found` or if it exists the return should be `200 Success`:
```json
{
"name": "raiBlocklistItemName",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/raiBlocklists/raiBlocklistName/raiBlocklistItems/raiBlocklistItemName",
"properties": {
"pattern": "Pattern To Block",
"isRegex": false
}
}
```

### Actual behavior

Always returning the status code `400 Bad Request` regardless of the input.

```
2024/12/30 15:28:31 failed to finish the request: GET https://management.azure.com/subscriptions//resourceGroups//providers/Microsoft.CognitiveServices/accounts//raiBlocklists//raiBlocklistItems/
--------------------------------------------------------------------------------
RESPONSE 400: 400 Bad Request
ERROR CODE UNAVAILABLE
--------------------------------------------------------------------------------
Response contained no body
--------------------------------------------------------------------------------
exit status 1
```

### Reproduction Steps

_No response_

### Environment

OS: `Windows 11`
Runtime: `Go 1.22`
SDK: `azure-sdk-for-go version 1.7.0`

>Note:
> You can also try to perform some test using Postman or directly in this [link](https://learn.microsoft.com/en-us/rest/api/aiservices/accountmanagement/rai-blocklist-items/get?view=rest-aiservices-accountmanagement-2024-10-01&tabs=HTTP)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.