Hexnode API Post command not working

birgitta
expand collapsive

Hii, we are facing some problems while testing out the Hexnode APIs. We were able to execute GET APIs successfully but when we try POST it does not execute successfully.
POSt commands tested –
POST https://xyz.hexnodemdm.com/api/v1/actions/associate_policy/
If it helps, we used this as body –

{
"users": [
{
"id": 2,
}
]
"policies": [
{
"id": 20,
}
]
}

All Replies

  • Zach Goodman

    Zach Goodman

    Hexnode

    Zach Goodman

    Moderator

    Hi @Birgitta, you can avoid this error by fixing the body content. The ‘policies’ key-value should come before the ‘users’ key-value. This way you’ll be associating the policy to the user which is the proper way to query it. 

    Corrected body – 

     
    {“policies”:[20],”users”:[2]} 
    

     
     
    Cheers! 
    Zach Goodman 
    Hexnode UEM

  • birgitta

    birgitta

    Participant

    birgitta

    Participant

    @zach-goodman I thought the order wouldn’t matter! got it. now it works fine.