From 9a20a8e55d4fe94e812f1730978d8e20d2533731 Mon Sep 17 00:00:00 2001 From: Skylar Ittner Date: Sat, 30 Dec 2017 14:39:03 -0700 Subject: [PATCH] Update API docs --- docs/API Documentation.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/API Documentation.md b/docs/API Documentation.md index 2234674..ed158a9 100644 --- a/docs/API Documentation.md +++ b/docs/API Documentation.md @@ -22,7 +22,7 @@ If the request is not well-formed (missing required arguments, invalid API key, | ------------- | --------------------------------------- | ----------- | `ping` | None | Used to check if the server is online and responding. Responds with `{"status":"OK"}`. | `auth` | `username`, `password` | Returns a status of `OK` if the user/pass combination are valid and allowed to login, otherwise returns `ERROR`. Also includes a `msg` with an error or success message. -| `userinfo` | `username` or `uid` | If the username or UID exist in the system, returns the user's profile data in the `data` field.
Response format:
"data":{
"uid": "123",
"username": "jdoe",
"name": "John Doe",
"email": "jdoe@example.com",
"phone":{
1: "1234567890",
2: ""
}
}
+| `userinfo` | `username` or `uid` | If the username or UID exist in the system, returns the user's profile data in the `data` field.
Response format:
"data":{
"uid": "123",
"username": "jdoe",
"name": "John Doe",
"email": "jdoe@example.com",
"phone": {
1: "1234567890",
2: ""
},
"pin": false/true
}
| `userexists` | `username` | Returns a field `exists` which is true if the username exists or false if it does not.
Example response: `{"status":"OK", "exists":true}` | `hastotp` | `username` | Returns a field `otp` which is true if the user has 2-factor authentication setup or false if the user does not. | `verifytotp` | `username`, `code` | Checks if the given TOTP code is valid for the given user at the current time. Returns with `{"status":"OK","valid":true}` or `{"status":"ERROR","msg":"","valid":false}`. @@ -38,7 +38,8 @@ If the request is not well-formed (missing required arguments, invalid API key, | `alertemail` | `username`, `appname` (optional) | Send alert email to system administrator regarding the specified user and application. | `codelogin` | `code` | Validate one-time code and (if successful) return username, realname, and uid for the user who generated the code. For code generation API, see `/mobile/index.php` | `listapps` | None | Get the list of configured apps from `settings.php` in `{"apps":{}}`. -| `getusersbygroup` | `gid`, `get` (optional) | Get all the user IDs in the specified group. If `get` equals `username`, return usernames instead of user IDs. +| `getusersbygroup` | `gid`, `get` (optional) | Get all the user IDs in the specified group. If `get` equals `username`, return usernames instead of user IDs. If `get` equals `detail`, return `[{username: x, name: y, uid: z, pin: true}]`, where `pin` is true if the user has a PIN set, otherwise false. | `getgroupsbyuser` | `uid` or `username` | Get a list of groups as `[{"id", "name"}]` the given user (by ID or username) is a member of. | `getgroups` | None | Get a list of all user groups in the database. -| `groupsearch` | `search` | Searches for groups with names containing the `search`. See `usersearch` for result format and more details. The differences are the fields returned (`id` and `name`) and the minimum query length (2 characters). \ No newline at end of file +| `groupsearch` | `search` | Searches for groups with names containing the `search`. See `usersearch` for result format and more details. The differences are the fields returned (`id` and `name`) and the minimum query length (2 characters). +| `checkpin` | `pin`, `username` or `uid` | Check if the supplied PIN matches the user's PIN. Returns a boolean `pinvalid`. If no PIN is set, returns a `status ERROR`, `pinvalid false`, and `nopinset true`. \ No newline at end of file