User Tools

Site Tools


start

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
start [2019/02/11 22:53]
kevincross Added details for lockFrozen
start [2019/02/11 23:20] (current)
kevincross
Line 1: Line 1:
-====== ChastiKey API (v0.2) ​======+====== ChastiKey API ====== 
 Based on simple REST principles, the ChastiKey API returns JSON data about a specific users active locks. Based on simple REST principles, the ChastiKey API returns JSON data about a specific users active locks.
  
-The ChastiKey API is in its infancy with the latest version (v0.2) still being in an early alpha stage. In order to progress and develop it further your feedback and suggestions are needed. Please discuss here on the forum: https://​www.chastikeyforums.com/​chastikey-chat/​chastikey-api-v0-2+The ChastiKey API is in its infancy with the latest version (v0.3) still being in an early alpha stage. In order to progress and develop it further your feedback and suggestions are needed. Please discuss here on the forum: https://​www.chastikeyforums.com/​chastikey-chat/​chastikey-api-v0-2
  
 Currently the ChastiKey API only returns data, you can’t use it to edit or manipulate locks. Currently the ChastiKey API only returns data, you can’t use it to edit or manipulate locks.
Line 8: Line 9:
 URLs are accessed via standard HTTPS requests and start with https://​api.chastikey.com/​. URLs are accessed via standard HTTPS requests and start with https://​api.chastikey.com/​.
  
-===== ChastiKey API URL ID’s & Parameters ===== +==== Versions Available ​==== 
-Version 0.2 of the ChastiKey API has the following two URLs available:​ +[[v0.3|ChastiKey API (v0.3)]]\\ 
- +[[v0.2|ChastiKey API (v0.2)]]
-https://​api.chastikey.com/​v0.2/​listlocks.php\\ +
-https://​api.chastikey.com/​v0.2/​checklock.php +
- +
-===== listlocks.php ===== +
-This script returns a list of locks that are active for a specific user id or username. The following parameter is required: +
- +
-**userid** or **username**\\ +
-https://​api.chastikey.com/​v0.2/​listlocks.php?​userid=xxxxx-xxxxx-xxxxx-xxxxx\\ +
-https://​api.chastikey.com/​v0.2/​listlocks.php?​username=xxxxxxxxxx +
- +
-The user id can be found from within the app. The user id contains 4 sets of 5 random letters and numbers, each set separated by a hyphen i.e.: A1B2C-3D4E5-F6G7H-8I9J0 +
- +
-The username can be found from within the app. It will be on the profile screen. If you haven'​t set a username it will be a default CKUXXXX one. +
- +
-Here’s an example of the data returned in JSON +
- +
-<​code>​ +
-+
-    "​response"​ : [ +
-        { +
-            "​status"​ : 200,  +
-            "​message"​ : "​Success",​  +
-            "​timestampGenerated"​ : 1541539882 +
-        } +
-    ],  +
-    "​locks"​ : [ +
-        { +
-            "​lockID"​ : 1537997743,  +
-            "​lockedBy"​ : "​Zoe",​ +
-            "​lockFrozen"​ : 0, +
-            "​timestampLocked"​ : 1537997743,  +
-            "​timestampUnlocked"​ : 0,  +
-            "​status"​ : "​Locked",​ +
-            "​combination"​ : 0 +
-        },  +
-        { +
-            "​lockID"​ : 1539201053,  +
-            "​lockedBy"​ : "",​ +
-            "​lockFrozen"​ : 0, +
-            "​timestampLocked"​ : 1539201053,  +
-            "​timestampUnlocked"​ : 1539287453,  +
-            "​status"​ : "​UnlockedFake",​ +
-            "​combination"​ : 48238191 +
-        },  +
-        { +
-            "​lockID"​ : 1539201053,  +
-            "​lockedBy"​ : "",​ +
-            "​lockFrozen"​ : "",​ +
-            "​timestampLocked"​ : 1539201053,  +
-            "​timestampUnlocked"​ : 1539287453,  +
-            "​status"​ : "​UnlockedReal",​ +
-            "​combination"​ : 22029321 +
-        } +
-    ] +
-+
-</​code>​ +
- +
-**response – status & message** +
-See status codes returned below. +
- +
-**response – timestampGenerated** +
-This shows the time the JSON data was generated. +
- +
-**locks – combination** +
-This shows the combination attached to the lock, but only if the lock status (see below) is flagged as UnlockedReal or UnlockedFake. Will return 0 if not yet unlocked. +
- +
-**locks – lockID** +
-This shows the lock IDs that you will also see at the top right of each lock in the app. You may notice that some locks in the list share the same ID, this happens when a lock was created with a number of fake locks. To hide which one is the real one and which are the fakes they all share the same ID. +
- +
-**locks – lockedBy** +
-This shows the username of the keyholder if the lock is controlled by a keyholder or bot. If not it will be blank. +
- +
-**locks – lockFrozen** +
-This shows the whether or not the lock is frozen. Will return 1 if frozen, and 0 if not frozen. +
- +
-**locks – status** +
-This returns one of 3 values, Locked, UnlockedReal,​ UnlockedFake. The real and fake unlocked values show whether or not it was a real or fake lock that unlocked. +
- +
-**locks – timestampLocked** +
-This returns the timestamp when the lock was first locked. +
- +
-**locks – timestampUnlocked** +
-This returns the timestamp when the lock was unlocked. Will return 0 if not yet unlocked. +
- +
-===== checklock.php ===== +
-This script returns the status of a particular lock, or set of locks based on a single lock ID. The following parameters are required: +
- +
-**userid** or **username**\\ +
-**lockid**\\ +
-https://​api.chastikey.com/​v0.2/​checklock.php?​userid=xxxxx-xxxxx-xxxxx-xxxxx&​lockid=xxx\\ +
-https://​api.chastikey.com/​v0.2/​checklock.php?​username=xxxxxxxxxx&​lockid=xxx +
- +
-The user id can be found from within the app. The user id contains 4 sets of 5 random letters and numbers, each set separated by a hyphen i.e.: A1B2C-3D4E5-F6G7H-8I9J0 +
- +
-The username can be found from within the app. It will be on the profile screen. If you haven'​t set a username it will be a default CKUXXXX one. +
- +
-The lock id can be found at the top right of each lock in the list of locks shown in the app. As mentioned above if the lock was created with fake copies then all locks from that set will share the same lock id and all of them will be returned in the JSON data from this script. +
- +
-Here’s an example of the data returned in JSON +
- +
-<​code>​ +
-+
-    "​response"​ : [ +
-        { +
-            "​status"​ : 200,  +
-            "​message"​ : "​Success",​  +
-            "​timestampGenerated"​ : 1541541818 +
-        } +
-    ​],  +
-    "​locks"​ : [ +
-        { +
-            "​lockID"​ : 1537997743,  +
-            "​lockedBy",​ "​Zoe",​ +
-            "​lockFrozen",​ 0, +
-            "​timestampLocked"​ : 1537997743,  +
-            "​timestampUnlocked"​ : 0,  +
-            "​status"​ : "​Locked",​ +
-            "​combination"​ : 0 +
-        } +
-    ​] +
-+
-</​code>​ +
- +
-**response – status & message** +
-See status codes returned below. +
- +
-**response – timestampGenerated** +
-This shows the time the JSON data was generated. +
- +
-**locks – combination** +
-This shows the combination attached to the lock, but only if the lock status (see below) is flagged as UnlockedReal or UnlockedFake. Will return 0 if not yet unlocked. +
- +
-**locks – lockID** +
-This shows the lock IDs that you will also see at the top right of each lock in the app. You may notice that some locks in the list share the same ID, this happens when a lock was created with a number of fake locks. To hide which one is the real one and which are the fakes they all share the same ID. +
- +
-**locks – lockedBy** +
-This shows the username of the keyholder if the lock is controlled by a keyholder or bot. If not it will be blank. +
- +
-**locks – lockFrozen** +
-This shows the whether or not the lock is frozen. Will return 1 if frozen, and 0 if not frozen. +
- +
-**locks – status** +
-This returns one of 3 values, Locked, UnlockedReal,​ UnlockedFake. The real and fake unlocked values show whether or not it was a real or fake lock that unlocked. +
- +
-**locks – timestampLocked** +
-This returns the timestamp when the lock was first locked. +
- +
-**locks – timestampUnlocked** +
-This returns the timestamp when the lock was unlocked. Will return 0 if not yet unlocked. +
- +
-===== Status Codes ===== +
-ChastiKey API uses the following response status codes: +
- +
-** 200 ** – Success, the request succeeded.\\ +
-** 204 ** – No content, the request succeeded but there was no data to return.\\ +
-** 400 ** – Bad Request. This might be an invalid, unrecognised or missing parameter. The message variable will contain more information. +
- +
-===== Rate Limiting / Cache =====  +
-The data returned is cached for 60 seconds to reduce the amount of database requests. If your program polls for the lock status more frequently than 60 seconds it will sometimes return cached data.+
start.1549925621.txt.gz · Last modified: 2019/02/11 22:53 by kevincross