The keyboard database supports external access so that your website or application can pull data on a particular keyboard or multiple keyboards in a standardised format. This page will detail how to make a request for such data and what format(s) the data will be provided in.
The API can be utilised by accessing the request URL https://sharktastica.co.uk/kb_db_req.php with some GET parametres. Any request will need to have two required parametres; the
dat return data type and a specific search parametre. The
dat parametre specifies what the returned data format should be, which at present includes JSON (stable) or XML (beta) support. As an example of implementing this with JSON as the chosen data type:
The specific search parametre specifies what data you want. A search can be made by using a field name (possible fields listed below) as a parametre name and giving it the search term value. For example, if you specifically want to see details belonging to part number 1391401, such as request would look like:
An optional parametre you can specify is the
fields filtering parametre. This will allow you to control what parts of the data should be returned to you by listing out the field names wanted (possible fields listed below). The order of the list will dictate the order of the fields returned. For example, if you want data on part number 1391401 but only want to see its part number, full name, type, first appeared date, OEMs and branding data, you could specify what fields you want in a comma-separated list like:
These field names are used for specifying a search parametre or for filtering what fields of data should be returned. Fields correspond to specific data on keyboards, which is explained in the key below.
Regardless of the amount of matched results, the items will be provided to you in an array format. So if you were expecting a single item to be returned, simply access it as the first item an the array.
If your request was unsuccessful, an array is still returned with a single item inside containing a single field - the
success field. This boolean field will always be present in successful or unsuccessful requests as a way to test the result, especially in cases where you're expecting multiple items where some operations differently may or may not have failed.