Skip to content

Legacy Api interface Deprecated!

Joerg edited this page Aug 9, 2023 · 1 revision

Table of Contents

Output

Structure

For XML output, the root node is Cloudlog-API.

There are two main sections to the output from the API. The first is the queryInfo section which holds debug-related information, and the second is the results section, which holds the actual returned data.

queryInfo

Needs writing

results

Each result is contained in an result element. The field values are given as element attributes.

Options

format

You can control the output format of API queries with the format argument.

XML

The default format is XML, and this is assumed if the argument isn't given. To force XML output, use format=xml.

XML (Plain)

By default, the XML is outputted with reference to an XSLT stylesheet. If you don't want this for some reason, then use format=xmlp.

JSON

For jQuery and other apps that can consume JSON, use format=json.

Methods

The methods are called using a semi-REST-style syntax, with the arguments separated by forward slashes (/).

The syntax for call the methods is http://logbook.url/index.php/api/method-name/key=API-key/format=format-type/argument/argument/argument/[...]/argument

search

This method queries the logbook for matching entries. This method requires at least read-only authorization.

Arguments

query

The actual query that is passed to the backend database.

The syntax for this can be a bit confusing for anything more than a simple query, but this belies the ability to perform complex queries if needed.

The query string is heavily sanitised before being passed through to MySQL, so in theory any query which can be accomplished with the usual keywords, operators and brackets can be performed. The supported keywords are and and or, and the supported operators are = (equals), ~ (like), > (greater than) and < (less than). Keywords must be enclosed in brackets (e.g. (and)).

Using the query Call~M0*(and)(Locator~I*(or)Locator~J*) as an example, it breaks down like this:-

  • Call~M0* - match rows where the Call field begins with M0 (using ~ for like)
  • (and) - a literal and
  • (Locator~I*(or)Locator~J*) - match rows where the 'Locator' field begins with either an I or a J. Note the (or) and the brackets around the two 'Locator' statements.
Put together, this query will return (by default, up to a maximum of 20) log entries where the other station callsign begins with M0 and their locator begins with I or J

See API/Fields for a full list of fields that can be used in API queries.

limit

The maximum amount of results to return.

This can be a single integer (e.g. 20) which will return the first 20 results, or two, separated by commas (e.g. 10, 20) which will return 20 results from the 10th result.

Examples
  • limit=0,20 - Return the first 20 results. This is the default.
  • limit=10,10 - Return 10 results, starting at the 10th result.

fields

The fields to return.

The fields specified are the same used by the query argument. This argument is analogous to the first part of a SQL SELECT query. Using it should be straightforward - all fields are separated by commas.

Examples
  • fields=Call - Return just the call.
  • fields=Call,Locator,Mode - Return the call, locator and transmission mode.
  • fields=distinct(Call),Locator - Return the call and locator, but only once per call. This is equivalent to SELECT DISTINCT(Call),Locator.

order

The fields to order the results by.

As with the fields query, this argument should be straightforward, and is the equivalent of SQL's ORDER BY.

Examples
  • order=Call(asc) - Return results in ascending order of call.

validate

This method takes one argument, which is the key argument. It will only ever return one result, containing one field, which is the output from the check of the API key.

  • 2 - The API key given has read/write permissions.
  • 1 - The API key given has read-only permissions.
  • 0 - The API key given is either disabled or does not exist.

add

Needs writing

update

Needs writing

Clone this wiki locally