Check the status of a specific lock, or locks within a single group.

Resource URL

https://api.chastikey.com/v0.5/checklock.php

Parameters

ParameterDescriptionOptionalDefault
ClientID ClientID is assigned to the API project that you create within the ChastiKey app.
ClientSecret ClientSecret is assigned to the API project that you create within the ChastiKey app. It can be re-generated within the app if needed.
DiscordID The Discord ID of the account that you want to return data for. This is required unless you're sending the users username instead.
LockGroupID LockGroupID is a 10 digit number assigned to identify what group the lock(s) belong in. Locks created with fake copies will all have the same LockGroupID value. True
LockID LockID is either a 10 digit or 12 digit number depending on when the lock was created. All locks created before v2.5.2 of ChastiKey are 10 digits and all locks created in v2.5.2 or higher are 12 digits. The first 10 digits of the 12 digit LockID is the same as LockGroupID. True
LockName LockName is the name given to the lock(s) by the lockee or keyholder in the ChastiKey app. If it's a keyholder controlled lock the name would be the same for all locks within the group. True
Username The username of the account that you want to return data for. This is required unless you're sending the users DiscordID instead.

Example

POST https://api.chastikey.com/v0.5/checklock.php

Request

  
    $curl = curl_init();

    curl_setopt_array($curl, array(
        CURLOPT_URL => "https://api.chastikey.com/v0.5/checklock.php",
        CURLOPT_HTTPHEADER => array(
            "ClientID: gvg3n9gzxmao21gpz143ij0yhn4gqalw",
            "ClientSecret: h3px2ifybw076n9qp3vr2gk5uvaolsks"
        ),
        CURLOPT_CUSTOMREQUEST => "POST",
        CURLOPT_POSTFIELDS => array(
            "Username" => "JohnDoe",
            "LockID" => 159224340901,
        ),
        CURLOPT_RETURNTRANSFER => TRUE,
        CURLOPT_FRESH_CONNECT => TRUE
    ));

    $response = curl_exec($curl);
    $err = curl_error($curl);

    curl_close($curl);

    if ($err) {
        echo "cURL Error #:".$err;
    } else {
        echo $response;
    }  

Success Response

  {
    "response": {
        "status": 200,
        "message": "the request has succeeded",
        "timestampGenerated": 1592248407
    },
    "locks": [
        {
            "lockGroupID": 1592243409,
            "lockID": 159224340901,
            "lockedBy": "",
            "lockName": "My first lock",
            "build": 205,
            "combination": "",
            "lockFrozen": 0,
            "status": "Locked",
            "test": 0,
            "timestampLocked": 1592243409,
            "timestampUnlocked": 0,
        }
    ]
}  

Error Response

  {
    "response": {
        "status": 400,
        "message": "required postdata missing: username or discordid",
        "timestampGenerated": 1579566341
    }
}  

Response Status Codes

CodeDescription
200 OK - The request has succeeded. The client can read the result of the request in the body and the headers of the response.
204 No Content - The request has succeeded but returns no message body.
400 Bad Request - The request could not be understood by the server due to malformed syntax. The message body will contain more information.
401 Unauthorized - The request requires user authentication or, if the request included authorization credentials, authorization has been refused for those credentials.
403 Forbidden - The server understood the request, but is either refusing to fulfill it, or the specific data you're requesting is private.
429 Too Many Requests - Rate limiting has been applied.

Resource Information

Rate Limited True
Response Format JSON
Authentication Tokens