Purview Discovery API - Status Code 400 - InvalidSearchQuery Error

Atha Dwira Perdana 0 Reputation points
2024-12-11T09:27:29.2266667+00:00

I'm trying to fetch data from my Azure Purview using Purview's Discovery - Query REST API, using the following request:

POST {endpoint}/datamap/api/search/query?api-version=2023-09-01

Here is my payload:

payload = {
  "limit": 100,
  "filter": 
  {
    "collectionId": "<collectionID>",
    "entityType": "oracle_table"
  }
}

I was able to get up to 210000 results, after that it always gives me this error:

Response: Status Code: 400 {"requestId":"55f1e7e2-4506-4003-b0b1-2e3d8c054886","errorCode":"InvalidSearchQuery","errorMessage":"The query request is invalid. Please check the payload and try again."} Total results fetched: 210000

any insights on this error? I'm not sure if it points to all data are already fetched or there's some issue with the API. I don't think all tables are returned from the API.

thank you in advance.

Microsoft Security | Microsoft Purview
{count} votes

1 answer

Sort by: Most helpful
  1. Ganesh Gurram 7,295 Reputation points Microsoft External Staff Moderator
    2024-12-11T18:06:55.3266667+00:00

    Hello @Atha Dwira Perdana

    Thanks for the question and using MS Q&A forum.

    The error you're encountering, InvalidSearchQuery, typically indicates that there is an issue with the structure or content of your query payload. Since you mentioned that you were able to fetch up to 210,000 results before receiving the error, it could suggest that the API has limitations on the number of results returned or that the query is becoming too complex or exceeds certain thresholds.

    Here are a few suggestions to consider:

    Check Payload Structure: Ensure that the payload is correctly structured according to the API documentation. Double-check the required fields and their formats.

    Limit Results: Since you are hitting a limit, consider implementing pagination in your requests. Instead of trying to fetch all results at once, you can use the limit and offset parameters to retrieve results in smaller batches.

    Review Collection ID: Make sure that the collectionId you are using is valid and that it corresponds to the data you expect to retrieve.

    API Version: Confirm that the API version you are using (2023-09-01) is compatible with the features you are trying to access.

    Error Handling: Implement error handling in your code to capture and log more details about the request and response, which may provide additional insights into what might be going wrong.

    For more details refer to this: Troubleshoot Microsoft Purview Data Map API request timeout exceptions

    Hope this helps. Do let us know if you have any further queries.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.