curl --request POST \
--url https://appdomain/api/v1/mdm/devices/{device_id}/actions/lock \
--header 'Accept: application/json' \
--header 'Authorization: d92d4xxxxxxxxxxxxx15f52' \
--header 'Content-Type: application/json' \
--data '{"unlock_pin":"1234.","lock_message":"This device has been locked by the administrator.","email_sent_to_user":"true.","phone_number":"000000000000."}'
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.io.IOException;
import java.net.http.HttpTimeoutException;
public class Main {
public static void main(String[] args) {
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://appdomain/api/v1/mdm/devices/{device_id}/actions/lock"))
.header("Content-Type", "application/json")
.header("Accept", "application/json")
.header("Authorization", " d92d4xxxxxxxxxxxxx15f52")
.method("POST", HttpRequest.BodyPublishers.ofString("{\"unlock_pin\":\"1234.\",\"lock_message\":\"This device has been locked by the administrator.\",\"email_sent_to_user\":\"true.\",\"phone_number\":\"000000000000.\"}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
import http.client
conn = http.client.HTTPSConnection("appdomain")
payload = "{\"unlock_pin\":\"1234.\",\"lock_message\":\"This device has been locked by the administrator.\",\"email_sent_to_user\":\"true.\",\"phone_number\":\"000000000000.\"}"
headers = {
'Content-Type': "application/json",
'Accept': "application/json",
'Authorization': " d92d4xxxxxxxxxxxxx15f52"
}
conn.request("POST", "/api/v1/mdm/devices/{device_id}/actions/lock", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
headersMap = Map();
headersMap.put("Content-Type", "application/json");
headersMap.put("Accept", "application/json");
data=Map();
data.put("lock_message","value");
data.put("phone_number","value");
data.put("unlock_pin","value");
data.put("email_sent_to_user",true);
response = invokeUrl
[
url: "https://appDomain/api/v1/mdm/devices/{device_id}/actions/lock"
type: POST
headers: headersMap
body: data
connection: connection_name
]
info response;
$headers=@{}
$headers.Add("Content-Type", "application/json")
$headers.Add("Accept", "application/json")
$headers.Add("Authorization", " d92d4xxxxxxxxxxxxx15f52")
$response = Invoke-WebRequest -Uri 'https://appdomain/api/v1/mdm/devices/{device_id}/actions/lock' -Method POST -Headers $headers -ContentType 'application/json' -Body '{"unlock_pin":"1234.","lock_message":"This device has been locked by the administrator.","email_sent_to_user":"true.","phone_number":"000000000000."}'
Sample Request Body
Lock device with a lock screen message
Copied!
{
"unlock_pin": "1234.",
"lock_message": "This device has been locked by the administrator.",
"email_sent_to_user": "true.",
"phone_number": "000000000000."
}
Duration - Time window for the threshold. Threshold - Number of API calls allowed within the specified duration. Lock Period - Wait time before consecutive API requests.