1
votes

We are having issue with OData API for an Azure search index that it is not returning metadata. We are able to perform OData based queries but not able to access metadata

Our expectation was that Odata end point

https://search-service-name.search.windows.net/indexes/index-name?api-version=2019-05-06&api-key=XXXXXXXXXXX&odata.metadata=full

should return the metadata. Other end points we have tried

https://search-service-name.search.windows.net/indexes('index-name')/$metadata?api-version=2019-05-06&api-key=XXXXXXXX&odata.metadata=full

If we use the api-key set up for querying, we get error
{ "error": { "code": "", "message": "Authorization failed." } }

Using Admin key as api-key, error returned is { "Message": "The given API key is not permitted in the URI query string." }

Has anyone else been able to get full OData API working with Azure search Index?

Thanks

1
I'm curious -- Why do you need full OData metadata?Bruce Johnston
We are currently looking to see if odata.metadata=minimal will be enough to configure Search Index documents as External Objects in SF.cre_user
Thanks for the info. I'm curious to learn more about this scenario. Depending on your usage pattern, pulling data from Azure Search directly via OData may or may not be a good idea. If you're interested in continuing this conversation, feel free to email me at bruce dot johnston at microsoft.Bruce Johnston

1 Answers

1
votes

Both odata.metadata=full and api-key need to be passed as HTTP headers, not query-string parameters. api-key is its own header, while odata.metadata=full is a parameter that should be part of the Accept header, like this: application/json;odata.metadata=full.

That said, unless you're trying to use Azure Search with an OData-enabled client for which you can't change the code, you shouldn't need the full OData metadata. At most you'd need odata.metadata=minimal to include type annotations for parts of the REST API that use inheritance (for example, when configuring analyzers, skills, or change/deletion detection policies for indexers).