JSON for CMD_ALL_USER_SHOW, CMD_RESELLER_SHOW, and CMD_ADMIN_SHOW

Version 1.52

Feature
Finished

JSON support has been added for the commands: CMD_ALL_USER_SHOW CMD_USER_SHOW CMD_RESELLER_SHOW CMD_ADMIN_SHOW where you simply add the GET request (not POST) json=yes and JSON is output. The format for all 3 is similiar, the existing table tokens are simply converted into json, so that we can maintain the searching, sorting and filtering features of the table class. Like other json table output, the format is a list of numbers, representing the row index displayed. Also an index called "info" is shown, to give info about the table: "info": { "columns": { "username": "1", "creator": "2", "bandwidth": "3", "quota": "4", "vdomains": "5", "suspended": "6", "ip": "7", "domains": "8", "sent_emails": "9" }, "current_page": "2", "ipp": "50", "rows": "69", "total_pages": "2" }, which is the "info" index for the CMD_ALL_USER_SHOW table. The other 2 (Reseller and Admin lists) look like: "info": { "columns": { "username": "1", "bandwidth": "2", "quota": "3", "nusers": "4", "vdomains": "5", "suspended": "6" }, "current_page": "1", "ipp": "50", "rows": "5", "total_pages": "1" }, where the "columns" sub-index represents the values shown in the table rows. ================================= A sample CMD_ALL_USER_SHOW row would be: "3": { "username": "admin:not_user", "creator": "root", "bandwidth": "2.76 / unlimited", "quota": "18839.4 / unlimited", "vdomains": "6 / unlimited", "suspended": "no:", "ip": "1.2.3.4:1.2.3.5:", "domains": "domain.com:pointer_domain.com=pointer.com|pointer2.com|:domain2.com:pointer_domain2.com=domain2-alias.com|:domain3.com:", "sent_emails": "2:1" }, where: - the username will contain the username, followed by a colon. After that, if it's a user, it will show "user". If it's not a user (admin or reseller), it will show not_user. This is used to link to CMD_SHOW_USER or CMD_SHOW_RESELLER (even admin's go to their Reseller info page) - vdomains is the number of domains on the account, followed by a space, forward slash, space, then the limited (number in meg, or unlimited) - the suspend item is similar, where after the colon will be the suspended reason, if set. Can be blank. Example: "yes:inactive", where the reason is from the "reasons" list (see below) - ip list is colon separated. - domains are also colon separated BUT any domain that starts with "pointer_" is a list of domain pointers, for the domain name contained in the string after pointer_. The pointer list starts after the = character, and is pipe | separated. - sent_emails contains the total number of sent emails this month, and after the colon, it's the number sent today. Somtimes there will be no colon or trailing value, eg, "0" The method is also adds an exrtra index, the other 2 don't have: add_leave_dns will be set to yes or no, to let you know if the "Leave Dns" checkbox should be shown (is controlled by the Multi-Server Setup clustering being turned on) ================================= CMD_USER_SHOW is very close to CMD_ALL_USER_SHOW, but without some of the columns: "0": { "username": "testuser", "bandwidth": "0.0000 / unlimited", "quota": "11.0 / unlimited", "vdomains": "1 / unlimited", "suspended": "no:", "ip": "1.2.3.4:", "domains": "domain.com:" }, it also does not have the "add_leave_dns" index, as it's not relevant for Resellers. ================================= A sample CMD_ADMIN_SHOW or CMD_RESELLER_SHOW would be: "0": { "username": "admin", "bandwidth": "1.0217 / unlimited", "quota": "19391 / unlimited", "nusers": "45", "vdomains": "67 / unlimited", "suspended": "no:" }, where the info is pretty much the same, but: - username does not need to be colon split, it's only the username, since the list is exactly the type you requested. - nusers is the number of User accounts created under this Admin or Reseller ============= Reasons: all 3 methods will also get a "reasons" index for the selectbox shown at the bottom of the GUI tables. "reasons": { "0": { "selected ": "yes", "text": "-- Reason:", "value": "none" }, "1": { "text": "Abuse", "value": "abuse" }, etc.. Where the "text" will be from the data/templates/suspension_reason.txt file, so may not be correctly translated (.po lookup?)

Interested to try DirectAdmin? Get a 30-day Free Trial!