Extension:WikiLambda/API
This page is part of the MediaWiki Action API documentation. |
The WikiLambda extension has a simple API for internal and external use. These APIs let you search and fetch WikiFunctions content and retrieve it in different formats and after different transformations.
These APIs are modules and submodules of MediaWiki Action API. You can make requests, explore the examples and see the results in the MediaWiki API Sandbox.
wikilambda_fetch Edit
This API allows to retrieve one or more of ZObject pages from Wikifunctions. Every requested ZObject will be returned as a string encoding its canonical JSON representation. If a particular language is requested, the ZObject will return its root object label in the selected language (or fallbacks).
This API, designed as an Action API module, is created for its external use and hence the returned ZObjects are encoded as strings. For internal use in the Wikifunctions application, please see below the documentation of #list=wikilambdaload_zobjects
Documentation Edit
Method: GET
Action: wikilambda_fetch
Request: api.php?action=wikilambda_fetch&format=json&zids=Z111|Z112&language=en
Response:
{
"Z111": {
"wikilambda_fetch": "{\n \"Z1K1\": \"Z2\",\n \"Z2K1\": \"Z111\"\n}"
},
"Z112": {
"wikilambda_fetch": "{\n \"Z1K1\": \"Z2\",\n \"Z2K1\": \"Z112\"\n}"
}
}
Parameters Edit
name | description |
---|---|
zids
required | string |
List of ZObject Identifiers (ZIDs) to fetch, separated by pipes.
E.g. |
language
optional | string |
String code for the language in which to return the results. Must be an accepted MediaWiki language code. If not present, the API will return the root label in all available languages.
E.g. |
Possible Errors Edit
This API expects no errors to be found. If any of the ZIDs is invalid or cannot be found, the returned object will consist solely on the found error and will not return the valid objects.
error name | error type (Z50) | description |
---|---|---|
Invalid ZID | Z549
|
The given ZID is an invalid ZObject ID. This means that it does not follow the expected format of ID starting with the capital letter Z and followed by a natural number. |
ZID not found | Z500
|
The given ZID does not exist in this wiki. |
Examples Edit
- api.php?action=wikilambda_fetch&format=json&zids=Z1
- Returns the canonical representation of the ZObject with ZID
Z1
with its labels in all available languages.
- api.php?action=wikilambda_fetch&format=json&zids=Z1|Z2|Z3
- Returns the canonical representation of the ZObjects with ZIDs
Z1
,Z2
andZ3
with its labels in all available languages.
- api.php?action=wikilambda_fetch&format=json&zids=Z4|Z6&language=es
- Returns the canonical representation of the ZObjects with ZIDs
Z4
andZ6
with its root-level label in Spanish or available fallback languages.
wikilambda_edit Edit
This internal API should never be called by any code except written by the Wikifunctions development team, and certainly not relied upon. It can change contract at any time, without warning. |
This API allows to create/edit persisted ZObject pages in Wikifunctions. The API expects the parameter zobject
to be a valid JSON representation of the ZObject in its canonical form.
To create a new ZObject, the parameter zid
must be omitted, and Wikifunctions will find and assign the next available ZID. Also, the keys from the JSON ZObject that refer to its identity (for example, Z2K1
or the values of Z4K1
and Z3K2
), must be set to the Null Reference (Z0
).
To edit an existing ZObject, the parameter zid
must have the ZID of the ZObject to edit (which will be the same one as the internal identity keys).
Documentation Edit
Method: GET
Action: wikilambda_edit
Request: api.php?action=wikilambda_edit&format=json&summary=TestSummary&zid=Z10001&zobject=<URL_ENCODED_JSON_OBJECT>
Response:
{
"wikilambda_edit": {
"success": "",
"articleId": 1096,
"title": "Z10001",
"page": "Z10001"
}
}
Parameters Edit
name | description |
---|---|
summary
required | string |
Summary message for the edit.
E.g. |
zid
optional | string |
ZID of the ZObject to edit. In case of creating a new ZObject, the field must be empty.
E.g. |
zobject
required | string |
JSON representation of the ZObject to be saved, in canonical form. If it's a new ZObject to be saved, the self-referential keys must be replaced by Z0 instead of the ZID. For example Z2K1 and Z4K1 must take the value of Z0, and the key IDs must be Z0K1, Z0K2, etc.
E.g. |
token
required | string |
CSRF token |
Possible Errors Edit
This API can return a wide variety of errors, because the provided ZObject is parsed and validated against the canonical schemata. All the validation errors will be wrapped in a error of type Z502
. Apart from the validation errors, Wikifunctions can detect a variety of problems described below.
error name | error type (Z50) | description |
---|---|---|
Validation error | Z502
|
The given ZObject is not well formed. The error body will contain the nested sub-errors that better describe the problem. For more information about nesting of validation error, read the Representation of errors page in meta. |
Invalid page title | Z556
|
The given ZID is an invalid page title and could not be created. |
Unmatching ZID and page title | Z555
|
The given ZID and the content of the self-referential keys (E.g. Z2K1) does not match. |
User does not have permission to edit | Z557
|
The user is not logged in or does not have the required permissions to create or edit pages. |
Disallowed root type | Z553
|
The ZPersistentObject or ZObject passed as the value of the zobject parameter is disallowed from being saved directly as a page. Disallowed ZObjects are Z3/Key, Z5/Error, Z16/Code, Z17/Argument declaration, Z18/Argument reference and Z39/Key reference.
|
Disallowed root type | Z553
|
The ZPersistentObject or ZObject passed as the value of the zobject parameter is disallowed from being saved directly as a page. Disallowed ZObjects are Z3/Key, Z5/Error, Z16/Code, Z17/Argument declaration, Z18/Argument reference and Z39/Key reference.
|
Label clash | Z554
|
The given label for a language clashes with another ZObject's label in that language. |
Examples Edit
- api.php?action=wikilambda_edit&format=json&summary=New zobject&zobject=urlencode( ZOBJECT )&token=%2B\
- Where ZOBJECT is:
{ "Z1K1": "Z2", "Z2K1": "Z0", "Z2K2": "zobject value", "Z2K3": { "Z1K1": "Z12", "Z12K1": [{ "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "zobject label" }] } }
- Creates and saves a new ZObject in the database (empty values) and returns the newly assigned ZID.
- api.php?action=wikilambda_edit&format=json&summary=Edit zobject&zid=Z10004&zobject=urlencode( ZOBJECT )&token=%2B\
- Where ZOBJECT is:
{ "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z10004" }, "Z2K2": "new zobject value", "Z2K3": { "Z1K1": "Z12", "Z12K1": [{ "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "new zobject label" }] } }
- Edits the ZObject with title Z10004 and overwrites it with the given JSON ZObject.
wikilambda_function_call Edit
This internal API should never be called by any code except written by the Wikifunctions development team, and certainly not relied upon. It can change contract at any time, without warning. |
One of the entrypoints to the Wikifunctions orchestration and evaluation back-end. This API receives a required JSON formatted ZObject and sends it to the function-orchestrator services for it to be evaluated and returned. Hence, the ZObject sent must be a Z7/Function call.
Documentation Edit
Method: GET
Action: wikilambda_function_call
Request: api.php?action=wikilambda_function_call&format=json&wikilambda_function_call_zobject=<URL_ENCODED_JSON_FUNCTION>
Response:
{
"query": {
"wikilambda_function_call": {
"Orchestrated": {
"success": "",
"data": "{\"Z1K1\":\"Z22\",\"Z22K1\":{\"Z1K1\":\"Z40\",\"Z40K1\":\"Z42\"},\"Z22K2\":\"Z23\"}"
}
}
}
}
Parameters Edit
name | description |
---|---|
wikilambda_function_call_zobject
required | string |
JSON representation of the ZObject to send for its execution
E.g. |
Possible Errors Edit
Describe function-orchestrator and evaluator most probable errors
error name | error type (Z50) | description |
---|---|---|
Connection error | (TODO) | Unable to connect to the function orchestrator service. |
Validation error | Z502
|
The given function call is not well formed. The error body will contain the nested sub-errors that better describe the problem. For more information about nesting of validation error, read the Representation of errors page in meta. |
Zid not found | Z504
|
One of the Type ZIDs from the objects involved in the function call cannot be found and hence cannot be validated. |
Argument type mismatch | Z506
|
The type of an argument instantiated in the function call does not match with its function argument definition. |
Error in evaluation | Z507
|
Something happened during the execution step which raised an error. The returned value of this error will also include the error propagated from the function evaluator and/or executor services. |
Argument value error | Z516
|
One of the arguments passed to a built-in function had a wrong value or type. |
Return type mismatch | Z517
|
The type returned by a function call does not match the expected type from that function definition. |
Object type mismatch | Z518
|
One of the arguments passed to the function call cannot be processed or their type evaluated. |
Unexpected ZObject type | Z542
|
(TODO) Currently this is Z539
The ZObject passed as |
Examples Edit
- api.php?action=wikilambda_function_call&format=json&wikilambda_function_call_zobject=<URL_ENCODED_JSON_FUNCTION>
- Where the function is:
{ "Z1K1": "Z7", "Z7K1": "Z802", "Z802K1": { "Z1K1": "Z40", "Z40K1": "Z42" }, "Z802K2": ["arbitrary ZObject"], "Z802K3": { "Z1K1": "Z40", "Z40K1": "Z42" } }
- Requests the execution of the function with ZID Z802 (built-in function
If(condition, then, else)
), where the value ofZ802K1/Condition
isZ42/False
. The expected result is to be returned the value ofZ802K3/Else
. The returned result, as expected: { "query": { "wikilambda_function_call": { "Orchestrated": { "success": "", "data": "{\"Z1K1\":\"Z22\",\"Z22K1\":{\"Z1K1\":\"Z40\",\"Z40K1\":\"Z42\"},\"Z22K2\":\"Z23\"}" } } } }
- Observe what happens when, instead of passing
Z42/False
as the condition, we passZ41/True
: { "query": { "wikilambda_function_call": { "Orchestrated": { "success": "", "data": "{\"Z1K1\":\"Z22\",\"Z22K1\":[\"arbitrary ZObject\"],\"Z22K2\":\"Z23\"}" } } } }
wikilambda_perform_test Edit
This internal API should never be called by any code except written by the Wikifunctions development team, and certainly not relied upon. It can change contract at any time, without warning. |
This is an internal API endpoint to query test results for a ZFunction. Accepts a Z8/Function
, a list of Z14/Implementations
, and a list of Z20/Testers
. Accepts a ZID for the ZFunction, and a list of either ZIDs or full JSON ZObjects for the ZImplementations and ZTesters.
If a test result is up-to-date in the results database cache, it will be retrieved from there. Otherwise, the test will be run by a call to the WikiFunctions orchestrator.
In addition, under certain conditions this API reorders the implementations of the given function and updates the function's Z8K4/implementations
property in persistent storage. The reordering indicates increasing average execution times of the orchestrator (and possibly other backend services) in running the ZTesters. Reordering only involves the function's currently attached ZImplementations and ZTesters. For reordering to occur, the requested ZImplementations / ZTesters must either be blank or a superset of currently attached ZImplementations / ZTesters, and there must be no results retrieved from the cache.
Documentation Edit
Method: GET
Action: wikilambda_perform_test
Request: api.php?action=wikilambda_perform_test&format=json&wikilambda_perform_test_zfunction=Z813&wikilambda_perform_test_zimplementations=Z913& wikilambda_perform_test_ztesters=Z8130
Response:
{
"query": {
"wikilambda_perform_test": [
{
"zFunctionId": "Z813",
"zImplementationId": "Z913",
"zTesterId": "Z8130",
"testMetadata": "...",
"validateStatus": "..."
}
]
}
}
Parameters Edit
name | description |
---|---|
wikilambda_perform_test_zfunction
required | string |
String ZID of the Z8/Function to test.
E.g. |
wikilambda_perform_test_zimplementations
optional | string |
Valid JSON representation of a list of Z14/Implementation objects. Each object can be either a canonical reference (ZID to that implementation), a literal Z14/Implementation object, or a literal Z2/Persistent object wrapping a Z14/Implementation.
E.g. If blank, all associated implementations will be run. |
wikilambda_perform_test_ztest
optional | string |
Valid JSON representation of a list of Z20/Tester objects. Each object can be either a canonical reference (ZID to that tester), a literal Z20/Tester object, or a literal Z2/Persistent object wrapping a Z20/Tester.
E.g. If blank, all associated testers will be run. |
Possible Errors Edit
If an error occurs when evaluating a given ZTester's Z20K2, this error will be found in the "errors" entry of the returned "testMetadata". The error may be of any sort returned by wikilambda_function_call
. If an error occurs when evaluating Z20K3, this will be found in the "validateErrors" entry.
Other errors this API method may return:
error name | description |
---|---|
wikilambda-performtest-error-unknown-zid | No object found with the ZID provided for the ZFunction, or the ZID provided for one of the given ZImplementations or ZTesters. |
wikilambda-performtest-error-nonfunction | The ZID provided for the ZFunction does not refer to an object of that type. |
wikilambda-performtest-error-nonimplementation | The ZID provided for a ZImplementation does not refer to an object of that type. |
wikilambda-performtest-error-nontester | The ZID provided for a ZTester does not refer to an object of that type. |
Examples Edit
- api.php?action=wikilambda_perform_test&format=json&wikilambda_perform_test_zfunction=Z813&wikilambda_perform_test_zimplementations=Z913&wikilambda_perform_test_ztesters=Z8130
- Requests running ZTester Z8130 on ZFunction Z813, with Z813 implemented by ZImplementation Z913.
- api.php?action=wikilambda_perform_test&format=json&wikilambda_perform_test_zfunction=Z813&wikilambda_perform_test_zimplementations=Z913
- Requests running all available ZTesters for ZFunction Z813, with Z813 implemented by Z913.
- api.php?action=wikilambda_perform_test&format=json&wikilambda_perform_test_zfunction=Z813&wikilambda_perform_test_ztesters=Z8130
- Requests running ZTester Z8130 on ZFunction Z813, with Z813 implemented by each of its available ZImplementations in turn.
- api.php?action=wikilambda_perform_test&format=json&wikilambda_perform_test_zfunction=Z813&wikilambda_perform_test_zimplementations=<URL_ENCODED_JSON_ZIMPLEMENTATION>&wikilambda_perform_test_ztesters=Z8130
- Requests running ZTester Z8130 on ZFunction Z813, with Z813 implemented by the ZImplementation encoded in URL_ENCODED_JSON_ZIMPLEMENTATION. Where URL_ENCODED_JSON_ZIMPLEMENTATION is
{ "Z1K1": "Z14", "Z14K1": "Z813", "Z14K3": { "Z1K1": "Z16", "Z16K1": { "Z1K1": "Z61", "Z61K1": "javascript" }, "Z16K2": "function Z813( Z813K1 ) {\n return Z813K1.length === 0;\n}" } }
- api.php?action=wikilambda_perform_test&format=json&wikilambda_perform_test_zfunction=Z813&wikilambda_perform_test_zimplementations=Z913&wikilambda_perform_test_ztesters=<URL_ENCODED_JSON_ZTESTER>
- Requests running the ZTester encoded in URL_ENCODED_JSON_ZTESTER on ZFunction Z813, with Z813 implemented by ZImplementation Z913. Where URL_ENCODED_JSON_ZTESTER is:
{ "Z1K1": "Z20", "Z20K1": "Z813", "Z20K2": { "Z1K1": "Z7", "Z7K1": "Z813", "Z813K1": [ "Z1" ] }, "Z20K3": { "Z1K1": "Z7", "Z7K1": "Z844", "Z844K2": { "Z1K1": "Z40", "Z40K1": "Z41" } } }
wikilambdaload_zobjects Edit
This internal API should never be called by any code except written by the Wikifunctions development team, and certainly not relied upon. It can change contract at any time, without warning. |
Similarly to the wikilambda_fetch
API detailed below, this API returns an aggregation of ZObject pages from Wikifunctions. This API is a list submodule of the action=query API and is dedicated to extension-wide internal requests. The return format is an array with the valid JSON representation of the ZObjects requested. It provides different parameters to configure the type of format to serialize the ZObjects to (either normal or canonical form) and the language for the object labels.
Documentation Edit
Method: GET
Action: query
List: wikilambdaload_zobjects
Request: api.php?action=query&format=json&list=wikilambdaload_zobjects&wikilambdaload_zids=Z111|Z112&wikilambdaload_language=en&wikilambdaload_canonical=1
Response:
{
"batchcomplete": "",
"query": {
"wikilambdaload_zobjects": {
"Z111": {
"success": "",
"data": {
"Z1K1": "Z2",
"Z2K1": "Z111"
}
},
"Z112": {
"success": "",
"data": {
"Z1K1": "Z2",
"Z2K1": "Z112"
}
}
}
}
}
Parameters Edit
name | description |
---|---|
wikilambdaload_zids
required | string |
List of ZObject Identifiers (ZIDs) to fetch, separated by pipes.
E.g. |
wikilambdaload_language
optional | string |
String code for the language in which to return the results. Must be an accepted MediaWiki language code. If not present, the API will return the root label in all available languages.
E.g. |
wikilambdaload_canonical
optional | boolean |
Whether to return the ZObjects in canonical or in its normalized form. The default value is false. If set to true, all the requested ZObjects will be returned in its canonical form. If not set, the ZObjects will be normalized and returned in their normal form, except for the ZList (Z10), which will be still returned as an array.
E.g. |
Possible Errors Edit
Unlike the wikilambda_fetch API, this API can handle errors while still returning the information of the ZObjects that have been found. The returned errors will also be ZObjects of type ZError (Z5). To distinguish between the return of an error in the API execution and the return of a requested ZError object, the response includes the value `success` for each of the requested `ZIDs`.
The possible errors that can be returned for an individual ZID are detailed below.
error name | error type (Z50) | description |
---|---|---|
Invalid ZID | Z549
|
The given ZID is an invalid ZObject ID. This means that it does not follow the expected format of ID starting with the capital letter Z and followed by a natural number. |
ZID not found | Z550
|
The given ZID does not exist in this wiki. |
Examples Edit
- api.php?action=query&format=json&list=wikilambdaload_zobjects&wikilambdaload_zids=Z1|Z2
- Returns the normal JSON representation of the ZObjects with ZID
Z1
andZ2
with its labels in all available languages.
- api.php?action=query&format=json&list=wikilambdaload_zobjects&wikilambdaload_zids=Z3|Z4&wikilambdaload_language=ay
- Returns the normal JSON representation of the ZObjects with ZIDs
Z3
andZ4
with all its ZMultilingual String (Z12) objects filtered to only return Aymaran labels. If an Aymaran label is not found, it will return those in any of the available fallback languages.
- api.php?action=query&format=json&list=wikilambdaload_zobjects&wikilambdaload_zids=Z6&wikilambdaload_canonical=1
- Returns the canonical representation of the ZObjects with ZID
Z6
.
wikilambdasearch_labels Edit
This internal API should never be called by any code except written by the Wikifunctions development team, and certainly not relied upon. It can change contract at any time, without warning. |
This API query list generator lets you search ZObjects by their labels or aliases in a given language. It also provides a series of parameters that allow to filter by the ZObject type or by the return type of existing ZFunctions. It principally exists to support the look-ahead search system, and it's generally used in the front-end components that allow the user to search and select persisted ZObjects.
Documentation Edit
Method: GET
Action: query
List: wikilambdasearch_labels
Request: api.php?action=query&format=json&list=wikilambdasearch_labels&wikilambdasearch_search=foo&wikilambdasearch_language=eu&wikilambdasearch_type=Z4&wikilambdasearch_return_type=Z4&wikilambdasearch_strict_return_type=true
Response:
{
"batchcomplete": "",
"query": {
"wikilambdasearch_labels": [
{
"page_namespace": 0,
"page_title": "Z111",
"page_type": "Z111",
"return_type": null,
"label": "foo",
"is_primary": 1,
"page_id": 0,
"page_content_model": "zobject",
"page_lang": "eu"
}
]
}
}
Parameters Edit
name | description |
---|---|
wikilambdasearch_search
required | string |
The search term to find in all the present labels.
E.g. |
wikilambdasearch_language
required | string |
String code for the language in which to return the results. Must be an accepted MediaWiki language code. If the labels aren't present for this language, use fallback languages.
E.g. |
wikilambdasearch_nofallback
optional | boolean (default=false) |
Whether to search only in the given language and not its fallback languages. If set to true, it will ignore the fallback languages and only search in the requested language.
E.g. |
wikilambdasearch_exact
optional | boolean (default=false) |
Whether to search for exact matches. If disabled, input will be taken as a case-insensitive, Unicode-normalised search with accents on Latin characters ignored.
E.g. |
wikilambdasearch_type
optional | string |
Restrict matches to a specific type of ZObject. If present, the search term will only be matched against the labels of ZObjects of the specified type. This is particularly useful for UI components such as the Type selector, which autocompletes a search input with only available ZType (Z4) objects.
E.g. |
wikilambdasearch_return_type
optional | string |
Restrict matches to ZFunctions that can return the given type, including those who return a generic ZObject. If present, the search term will only be matched against the labels of the specified type. If present along with the wikilambdasearch_type, the results will contain all results matching the type OR the return_type.
E.g. |
wikilambdasearch_strict_return_type
optional | boolean (default=false) |
If the parameter wikilambdasearch_return_type is present, setting this parameter to true will exclude the generic ZObjects from the result and will only return the rows that match strictly the return type passed as a parameter. If the parameter wikilambdasearch_return_type is not set, this value is irrelevant: it will not affect those matches returned by type (parameter wikilambdasearch_type).
E.g. |
wikilambdasearch_limit
optional | integer |
The maximum number of results to return. The value must be between 1 and 5000. Enter max to use the maximum limit.
E.g. |
wikilambdasearch_continue
optional | integer |
When more results are available, use this to continue.
E.g. |
Possible Errors Edit
None. When nothing is found it will return an empty list.
Examples Edit
- api.php?action=query&format=json&list=wikilambdasearch_labels&wikilambdasearch_search=ThisLabelDoesNotExist&wikilambdasearch_language=en
- No labels in English match or contain the substring ThisLabelDoesNotExist, so an empty batch is returned.
- api.php?action=query&format=json&list=wikilambdasearch_labels&wikilambdasearch_search=TEX&wikilambdasearch_language=en
- Return every label matching or containing the substring TEX in English. This might ensure that at least two builtin ZObjects will be returned: Z12 "Multilingual text" and Z11 "Monolingual text".
- api.php?action=query&format=json&list=wikilambdasearch_labels&wikilambdasearch_search=TEX&wikilambdasearch_language=en&wikilambdasearch_exact=1
- Return every label matching or containing the exact substring TEX in English. This will not return the two ZObjects returned in the previous example, as this search is case-sensitive.
- api.php?action=query&format=json&list=wikilambdasearch_labels&wikilambdasearch_language=en&wikilambdasearch_return_type=Z40
- Return the English label of every entry that has a ZBoolean (Z40) return type, including those that have a generic ZObject (Z1) return type.
- api.php?action=query&format=json&list=wikilambdasearch_labels&wikilambdasearch_language=en&wikilambdasearch_return_type=Z40&wikilambdasearch_strict_return_type=true
- Return the English label of every entry that has strictly a ZBoolean (Z40) return type.
wikilambdafn_search Edit
This internal API should never be called by any code except written by the Wikifunctions development team, and certainly not relied upon. It can change contract at any time, without warning. |
This API query list searches for the IDs of all ZObjects associated with a provided Z8/Function
ZID and that belong to a given type (either Z14/Implementations
or Z20/Testers
).
Documentation Edit
Method: GET
Action: query
List: wikilambdafn_search
Request: api.php?action=query&format=json&list=wikilambdafn_search&wikilambdafn_zfunction_id=Z801&wikilambdafn_type=Z20
Response:
{
"batchcomplete": "",
"query": {
"wikilambdafn_search": [
"Z8010",
"Z8011",
"Z8012",
"Z8013"
]
}
}
Parameters Edit
name | description |
---|---|
wikilambdafn_zfunction_id
required | string |
ZID belonging to the function of which we want to retrieve the associated ZObjects.
E.g. |
wikilambdafn_type
required | string |
Type of ZObjects related to the given function that we would like to retrieve. The value of this field is not restricted, although the typical values related to functions would be Z14/Implementation or Z20/Tester.
E.g. |
wikilambdafn_limit
optional | integer |
The maximum number of results to return. The value must be between 1 and 5000. Enter max to use the maximum limit.
E.g. |
wikilambdafn_continue
optional | integer |
When more results are available, use this to continue.
E.g. |
Possible Errors Edit
None. When nothing is found it will return an empty list.
Examples Edit
- api.php?action=query&format=json&list=wikilambdafn_search&wikilambdafn_zfunction_id=Z801&wikilambdafn_type=Z20
- Returns the list of Z20/Testers associated to the function with ZID Z801
- api.php?action=query&format=json&list=wikilambdafn_search&wikilambdafn_zfunction_id=Z801&wikilambdafn_type=Z14
- Returns the list of Z14/Implementations associated to the function with ZID Z801
wikilambda_health_check Edit
This internal API should never be called by any code except written by the Wikifunctions development team, and certainly not relied upon. It can change contract at any time, without warning. |
This is an internal API for performing health check against the wikilambda + function orchestrator + function evaluator interface. It performs a few example function calls against the orchestrator and checks the response against the expected outcomes. It takes no argument.
We have set up a prometheus blackbox probe that calls this API every 15 seconds to confirm the liveliness and correctness of our services. Beware that currently (Aug 2022) this endpoint can return failed results due to flakiness in the orchestrator (possibly due to load capacity).
Documentation Edit
Method: GET
Action: wikilambda_health_check
Request: api.php?action=wikilambda_health_check
Response:
{
"query": {
"wikilambda_health_check": {
"success": "true",
"total_tests": 3,
"tested": 3,
"passed": 3,
"error": ""
}
}
}
Response content: Edit
Key | Value | Description |
---|---|---|
success | "true" | "false" | Whether the health check passed. This field is only "true" if `passed` equals `total_tests`. |
total_tests | int | The number of tests that this health check intends to run. |
tested | int | The number of tests that this health check actually got to run. This might be smaller than `total_tests` because a test threw an error. |
passed | int | The number of tests that passed in this check. |
error | string | The first error encountered by this health check. |
Possible outcomes Edit
- Successful
- success = "true"
- total_tests = tested = passed
- error = ""
- Failed without error (incorrect test results):
- success = "false"
- total_tests = tested > passed
- error = ""
- Failed with error:
- success = "false"
- total_tests > tested > passed
- error != ""
wikilambda_supported_programming_languages Edit
This internal API should never be called by any code except written by the Wikifunctions development team, and certainly not relied upon. It can change contract at any time, without warning. |
This is an internal API to retrieve the programming languages supported by the back-end evaluator service at the time of running, and so determine which languages to recommend to users on the front end. It takes no parameters.
Documentation Edit
Method: GET
Action: wikilambda_supported_programming_languages
Request: api.php?action=wikilambda_supported_programming_languages
Response:
{
"query": {
"wikilambda_supported_programming_languages": {
"success": true,
"data": "[\"javascript-es2020\",\"javascript-es2019\",\"javascript-es2018\",\"javascript-es2017\",\"javascript-es2016\",\"javascript-es2015\",\"javascript\",\"python-3-9\",\"python-3-8\",\"python-3-7\",\"python-3\",\"python\"]"
}
}
}
Response content: Edit
Key | Value | Description |
---|---|---|
success | "true" | "false" | Whether the server responded. |
data | string | An escaped JSON array of the supported programming languages (by internal WikiLambda name). |
Possible Errors Edit
None, unless the orchestrator back-end service doesn't respond.