Fetch Object
GET | www.wikifunctions.org/w/api.php?action=wikilambda_fetch&zids={objectid}&format=json
|
---|
Fetches and retrieves one or more Object pages from Wikifunctions. Every requested Object will be returned as a string encoding its canonical JSON representation. If a particular language is requested, the Object labels will be filtered to return only the selected or most relevant language available.
Examples
curl
# Fetch the object with unique ID Z801 from the Wikifunctions library of functions
$ curl 'https://www.wikifunctions.org/w/api.php?action=wikilambda_fetch&zids=Z801&format=json'
Python
# Python 3
# Fetch the object with unique ID Z801 from the Wikifunctions library of functions
import requests
zid = 'Z801'
url = 'https://www.wikifunctions.org/w/api.php?action=wikilambda_fetch&zids=' + zid + '&format=json'
response = requests.get(url)
data = response.json()
print(data)
PHP
<?php
// Fetch the object with unique ID Z801 from the Wikifunctions library of functions
$zid = 'Z801';
$url = 'https://www.wikifunctions.org/w/api.php?action=wikilambda_fetch&zids=' . zid . '&format=json';
$ch = curl_init( $url );
$output = curl_exec( $ch );
curl_close( $ch );
echo( $output );
?>
JavaScript
// Fetch the object with unique ID Z801 from the Wikifunctions library of functions
let zid = 'Z801';
let url = 'https://www.wikifunctions.org/w/api.php?action=wikilambda_fetch&zids=' + zid + '&format=json';
let response = await fetch( url );
response.json()
.then(console.log)
.catch(console.error);
Parameters
zids
required string |
List of Object Identifiers (ZIDs) to fetch, separated by pipes. For example: zids=Z1|Z2|Z3
|
revisions
optional string |
List of Revision IDs for each of the specified Object ZID. If unset, the endpoint will return the latest revision. There should be the same number of Revision IDs as Object ZIDs, or none at all. For example: revisions=100|101|102
|
language
optional string |
Language code to return the Object labels in. For example: ar (Arabic), en (English), es (Spanish). List supported languages.
|
Responses
200 | Success | Object found. Returns the encoded JSON value of the requested object.
Example
{
"Z111": {
"wikilambda_fetch": "{\n \"Z1K1\": \"Z2\",\n \"Z2K1\": \"Z111\"\n}"
},
"Z112": {
"wikilambda_fetch": "{\n \"Z1K1\": \"Z2\",\n \"Z2K1\": \"Z112\"\n}"
}
}
|
---|---|---|
400 | Z500: Error | The number of Object IDs in the zids parameter doesn't match the number of requested Revision IDs.
Example
{
"error": {
"code": "wikilambda-zerror",
"info": "Error of type Z500",
"message": "Unspecified error",
"zerror": {
"Z1K1": "Z5",
"Z5K1": "Z500",
"Z5K2": {
"Z1K1": {
"Z1K1": "Z7",
"Z7K1": "Z885",
"Z885K1": "Z500"
},
"K1": "You must specify a revision for each ZID, or none at all."
}
},
"labelled": {
"type": "Error",
"error type": "Unspecified error",
"error value": {
"type": {
"type": "Function call",
"function": "Errortype to type",
"errortype": "Unspecified error"
},
"error information": "You must specify a revision for each ZID, or none at all."
}
}
}
}
|
404 | Z549: Invalid reference | The zids parameter contains one or more invalid Object references. A valid Object reference must be a number prefixed by Z .
Example
{
"error": {
"code": "wikilambda-zerror",
"info": "Error of type Z549",
"message": "Invalid reference",
"zerror": {
"Z1K1": "Z5",
"Z5K1": "Z549",
"Z5K2": {
"Z1K1": {
"Z1K1": "Z7",
"Z7K1": "Z885",
"Z885K1": "Z549"
},
"K1": "BAD REFERENCE"
}
},
"labelled": {
"type": "Error",
"error type": "Invalid reference",
"error value": {
"type": {
"type": "Function call",
"function": "Errortype to type",
"errortype": "Invalid reference"
},
"reference value": "BAD REFERENCE"
}
}
}
}
|
404 | Z550: Unknown reference | One or more of the Object references passed in the parameter parameters zids could not be found.
Example
{
"error": {
"code": "wikilambda-zerror",
"info": "Error of type Z550",
"message": "Unknown reference",
"zerror": {
"Z1K1": "Z5",
"Z5K1": "Z550",
"Z5K2": {
"Z1K1": {
"Z1K1": "Z7",
"Z7K1": "Z885",
"Z885K1": "Z550"
},
"K1": {
"Z1K1": "Z6",
"Z6K1": "Z1000"
}
}
},
"labelled": {
"type": "Error",
"error type": "Unknown reference",
"error value": {
"type": {
"type": "Function call",
"function": "Errortype to type",
"errortype": "Unknown reference"
},
"reference value": {
"type": "String",
"value": "Z1000"
}
}
}
}
}
|