Forum Discussion

DLGross's avatar
DLGross
Frequent Visitor
1 year ago
Solved

Web.Contents failed to get contents (400) bad request error

I am getting the subject error when I try to query the advanced hunting api in Defender. The query works fine in the Defender portal. Can anyone provide any troubleshooting tips?

  • Hi  DLGross,

    Thank you for reaching out to the Microsoft Fabric Forum Community.

     

    The suggestion from lbendlin, is a great starting point. Testing your API call in Postman can help determine whether the issue is with the API itself or how it’s being called using Web.Contents. 

    If it works in Postman, the issue might be related to: 

    • Make sure you are using a valid OAuth 2.0 token with the required permissions (AdvancedHunting.Read or AdvancedHunting.Read.All). 
    • Ensure you are using the correct endpoint for the Advanced Hunting API. The API requires a POST method, not GET. 

    If this post helps, then please give us ‘Kudos’ and consider Accept it as a solution to help the other members find it more quickly.

     

    Thank you.

5 Replies

  • Does it work in Postman? How are you authenticating?

     

  • v-saisrao-msft's avatar
    v-saisrao-msft
    Community Support

    Hi  DLGross,

    Thank you for reaching out to the Microsoft Fabric Forum Community.

     

    The suggestion from lbendlin, is a great starting point. Testing your API call in Postman can help determine whether the issue is with the API itself or how it’s being called using Web.Contents. 

    If it works in Postman, the issue might be related to: 

    • Make sure you are using a valid OAuth 2.0 token with the required permissions (AdvancedHunting.Read or AdvancedHunting.Read.All). 
    • Ensure you are using the correct endpoint for the Advanced Hunting API. The API requires a POST method, not GET. 

    If this post helps, then please give us ‘Kudos’ and consider Accept it as a solution to help the other members find it more quickly.

     

    Thank you.

  • v-saisrao-msft's avatar
    v-saisrao-msft
    Community Support

    Hi DLGross,
    I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
    Thank you.

  • v-saisrao-msft's avatar
    v-saisrao-msft
    Community Support

    Hi DLGross,

    May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

    Thank you.

  • v-saisrao-msft's avatar
    v-saisrao-msft
    Community Support

    Hi DLGross,

     

    We haven’t heard back from you regarding your issue. If it has been resolved, please mark the helpful response as the solution and give a ‘Kudos’ to assist others. If you still need support, let us know.

     

    Thank you.