HTTP API SQLite Access

#1

Four query API calls are provided as part of the SQLite Access API. The calls all return JSON formatted data for easy processing.

Table Exists
To query to ensure that a given table exists:
http://localhost:25000/dbquery?table=table_name&tableExists&webauth=webauth_value

This will return a JSON object:

{ 
    "table": {  
        "table_name": "tableName",  
        "exists": true  
    }  
}

Retrieve Keys from Table
To fetch the keys from a given table:
http://localhost:25000/dbquery?table=table_name&getKeys&webauth=webauth_value

This will return a JSON object:

{  
    "table": {  
        "table_name": "tableName",  
        "keylist": [  
            {  
                "key": "keyString"  
            }  
        ]  
    }  
}  

Check for Existence of Key
To verify that a key exists in a given table:
http://localhost:25000/dbquery?table=table_name&keyExists=key&webauth=webauth_value

This will return a JSON object:

{  
    "table": {  
        "table_name": "tableName",  
        "key": "keyString",  
        "keyExists": true  
    }  
}  

Retrieve Data by Key
To retrieve data related to a key:
http://localhost:25000/dbquery?table=table_name&getData=key&webauth=webauth_value
This will return a JSON object:

{  
    "table": {  
        "table_name": "tableName",  
        "key": "keyString",  
        "value": "valueString"  
    }  
}  

Retrieve Keys and Values for a Table
http://localhost:25000/dbquery?table=table_name&getAllRows&webauth=webauth_value
http://localhost:25000/dbquery?table=table_name&getSortedRows&webauth=webauth_value
http://localhost:25000/dbquery?table=table_name&getSortedRowsByValue&webauth=webauth_value

{
   "table": {
      "table_name":"command",
      "results":[
      {
         "key":"uptime",
         "value":"(pointtouser) (channelname) has been online for (uptime)"
      },
      {
         "key":"followage",
         "value":"(followage)"
      }
}

Error
If an error occurs, a JSON object is returned:

{  
    "error": "error message"
}  
1 Like
Raffle System from the POV of a Moderator and a Streamer
Pulling player all players' points info from the database into a text file manually, maybe?
How to get KeyValueList with HTTP Request?
In need of Better encoding support for HttpRequest
Intergrations? (Website)
Two suggestions to make custom commands/APIs work better