API calls generate 400 bad requestSolved

Participant
Discussion
3 years ago

Hi everyone,

I am trying to figure out why the API call generates 400 bad request. The API executes the enable lost mode on iOS.

Replies (4)

Marked SolutionPending Review
Participant
3 years ago
Marked SolutionPending Review

Check with the authorization and other information used.

Marked SolutionPending Review
Hexnode Expert
3 years ago
Marked SolutionPending Review

Hi @tamsin-tim

400-Bad Request error code is generated when the web-service request is invalid. Kindly re-assure that you make a valid HTTP request.

Catherine George

Hexnode UEM

Marked SolutionPending Review
Participant
3 years ago
Marked SolutionPending Review

Attempting to make the below HTTP request:
curl -H “Authorization:DavLbkECurylxJG1tjx7” -H “Content-Type:application/json” -d '{"users":[0],"usergroups”:[0],”devices”:[1],”devicegroups”:[0]}’ https://rdspos.hexnodemdm.com/api/v1/actions/enable_lostmode/

The API call generates the following HTTP response:

“Content-Type:application/json” -d ‘{“devices”:[1]}’ https://rdspos.hexnodemdm.com/api/v1/actions/enable_lostmode/<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"><html><head><title>400 Bad Request</title></head><body><h1>Bad Request</h1><p>Your browser sent a request that this server could not understand.<br /></p></body></html>

Any suggestions of improvement?

Marked SolutionPending Review
Hexnode Expert
3 years ago
Marked SolutionPending Review

Well, it seems that you have used inappropriate quotes to enclose parameters in the API call.

I am reminding you that and " are not the same. Though it looks similar, these quotation marks are different from each other. You are supposed to use straight double quotes " throughout.

Catherine George

Hexnode UEM

  • This reply was modified 3 years, 1 month ago by  Catherine.
  • This reply was modified 3 years, 1 month ago by  Catherine.
  • This reply was modified 3 years, 1 month ago by  Catherine.
Save