Sketch Engine uses HTTP REST API. All API methods (unless stated otherwise) expect GET HTTP requests.
A description of creating a query via JSON API that you want to work with. A Sketch Engine query is a URL of the following structure:
- <base_url> is the path to the main CGI script, "run.cgi", e.g. https://api.sketchengine.co.uk/bonito/run.cgi.
- <method> is the particular method name, e.g. "wsketch" for word sketches.
- <attributes_and_values> is the list of attributes and values in the CGI notation, that isattribute_1=value_1&attribute_2=value_2& ... &attribute_n=value_n .
See the complete list of methods and attributes
If the Sketch Engine runs on a local machine, 'base_url' usually starts with 'http://localhost/'.
(see FUP) is applicable, you need to limit the frequency of API requests. It can be done using standard libraries in various programming languages, e.g. time.sleep(1) in Python.
An example of Sketch Engine query can look like this:
It is a query that returns word sketch HTML page for corpus "preloaded/bnc2", and lemma test as a noun ("lpos=-n").
In the case Sketch Engine can't answer the requests, it throws error. In the case of JSON format, the response contains key "error" with a message explaining what happened. HTTP status value is changed accordingly too.