Help
Difference between revisions of "APIs"
Line 4: | Line 4: | ||
! API point || Query || Example of returned sub-item | ! API point || Query || Example of returned sub-item | ||
|- | |- | ||
− | | [https://commons.wikimedia.org/w/api.php Commons] || [https://commons.wikimedia.org/w/api.php?origin=*&action=query&format=json&ailimit=500&aistart=2018-01-01T00:00:01Z&aiuser=Yug&list=allimages&aisort=timestamp&aiprop=user%7Cmime%7Csize%7Curl List of 500 files by User:Yug, since 2018-01-01 and after, with username, mime, size and url] || <pre>{ | + | | [https://commons.wikimedia.org/w/api.php Commons] > [[:mw:API:Allimages|API:Allimages]] || [https://commons.wikimedia.org/w/api.php?origin=*&action=query&format=json&ailimit=500&aistart=2018-01-01T00:00:01Z&aiuser=Yug&list=allimages&aisort=timestamp&aiprop=user%7Cmime%7Csize%7Curl List of 500 files by User:Yug, since 2018-01-01 and after, with username, mime, size and url] || <pre>{ |
"name": "LL-Q150_(fra)-Yug-retour.wav", | "name": "LL-Q150_(fra)-Yug-retour.wav", | ||
"user": "Yug", | "user": "Yug", | ||
Line 20: | Line 20: | ||
</pre> | </pre> | ||
|- | |- | ||
− | | Commons || [https://commons.wikimedia.org/w/api.php?origin=*&action=query&format=json&ailimit=500&aiprefix=LL-Q150_(fra)&list=allimages&aisort=name&aiprop=user%7Cmime%7Csize%7Curl List of 500 files prifixed by 'LL-Q150_(fra)', aka French language files, sorted by name, with username, mime, size and url] || <pre>{ | + | | Commons > [[:mw:API:Allimages|API:Allimages]] || [https://commons.wikimedia.org/w/api.php?origin=*&action=query&format=json&ailimit=500&aiprefix=LL-Q150_(fra)&list=allimages&aisort=name&aiprop=user%7Cmime%7Csize%7Curl List of 500 files prifixed by 'LL-Q150_(fra)', aka French language files, sorted by name, with username, mime, size and url] || <pre>{ |
"name": "LL-Q150_(fra)-Yug-retour.wav", | "name": "LL-Q150_(fra)-Yug-retour.wav", | ||
"user": "Yug", | "user": "Yug", | ||
Line 36: | Line 36: | ||
</pre> | </pre> | ||
|- | |- | ||
− | | Commons || [https://commons.wikimedia.org/w/api.php?origin=*&action=query&format=json&ailimit=500&aiprefix=LL-Q150_(fra)-Yug&list=allimages&aisort=name&aiprop=user%7Cmime%7Csize%7Curl List of 500 files prefixed by 'LL-Q150_(fra)-Yug', aka French language files by user:Yug, sorted by name, with username, mime, size and url] || <pre>{ | + | | Commons > [[:mw:API:Allimages|API:Allimages]] || [https://commons.wikimedia.org/w/api.php?origin=*&action=query&format=json&ailimit=500&aiprefix=LL-Q150_(fra)-Yug&list=allimages&aisort=name&aiprop=user%7Cmime%7Csize%7Curl List of 500 files prefixed by 'LL-Q150_(fra)-Yug', aka French language files by user:Yug, sorted by name, with username, mime, size and url] || <pre>{ |
"name": "LL-Q150_(fra)-Yug-retour.wav", | "name": "LL-Q150_(fra)-Yug-retour.wav", | ||
"user": "Yug", | "user": "Yug", | ||
Line 52: | Line 52: | ||
</pre> | </pre> | ||
|- | |- | ||
− | | [https://commons.wikimedia.org/w/api.php Commons] || [https://commons.wikimedia.org/w/api.php?origin=*&action=query&format=json&lelimit=500&lestart=2022-01-01T00:00:01Z&leuser=Yug&list=logevents&leaction=upload/upload List of 500 log events by User:Yug, type upload/upload, from 2022-01-01 and before] || <pre>{ | + | | [https://commons.wikimedia.org/w/api.php Commons] > [[:mw:API:Logevents|API:Logevents]] || [https://commons.wikimedia.org/w/api.php?origin=*&action=query&format=json&lelimit=500&lestart=2022-01-01T00:00:01Z&leuser=Yug&list=logevents&leaction=upload/upload List of 500 log events by User:Yug, type upload/upload, from 2022-01-01 and before] || <pre>{ |
"logid": 310250995, | "logid": 310250995, | ||
"ns": 6, | "ns": 6, | ||
Line 69: | Line 69: | ||
}</pre> | }</pre> | ||
|- | |- | ||
− | | Commons || [https://commons.wikimedia.org/w/api.php?action=opensearch&search=LL-Q140193%20(bci)-Olivier%20Yao-&profile=fuzzy&namespace=6&limit=3&format=json Search for files, prefixed with <code>LL-Q140193 (bci)-Olivier Yao-</code>, return in OpenSearch format] ||<pre>[ | + | | Commons > [[:mw:API:Opensearch|API:Opensearch]] || [https://commons.wikimedia.org/w/api.php?action=opensearch&search=LL-Q140193%20(bci)-Olivier%20Yao-&profile=fuzzy&namespace=6&limit=3&format=json Search for files, prefixed with <code>LL-Q140193 (bci)-Olivier Yao-</code>, return in OpenSearch format] ||<pre>[ |
"LL-Q140193 (bci)-Olivier Yao-", | "LL-Q140193 (bci)-Olivier Yao-", | ||
[ "File:LL-Q140193 (bci)-Olivier Yao-n\u0254n.wav", "File:LL-Q140193 (bci)-Olivier Yao-oto.wav" ], | [ "File:LL-Q140193 (bci)-Olivier Yao-n\u0254n.wav", "File:LL-Q140193 (bci)-Olivier Yao-oto.wav" ], | ||
Line 78: | Line 78: | ||
] | ] | ||
]</pre> | ]</pre> | ||
+ | |- | ||
+ | | Commons > [[:mw:Special:MyLanguage/API:Search|API:Search]] || [https://commons.wikimedia.org/w/api.php?action=query&list=search&srlimit=100&srsearch=intitle:/LL-Q150.*-vert\.wav/&srnamespace=6&srwhat=text&srprop=timestamp&utf8=true Search via regex <code>intitle:/LL-Q150.*-vert\.wav/</code> | ||
+ | || <pre>{ | ||
+ | "ns": 6, | ||
+ | "title": "File:LL-Q150 (fra)-Roll-Morton-vert.wav", | ||
+ | "pageid": 70168118, | ||
+ | "timestamp": "2021-08-23T12:22:30Z" | ||
+ | }</> | ||
|} | |} | ||
Revision as of 14:45, 3 December 2021
APIs are interface system allowing an url query to access data on a server. In the case of LinguaLibre, two APIs are used: LinguaLibre and Commons Wikimedia. Below are some useful examples.
API point | Query | Example of returned sub-item |
---|---|---|
Commons > API:Allimages | List of 500 files by User:Yug, since 2018-01-01 and after, with username, mime, size and url | { "name": "LL-Q150_(fra)-Yug-retour.wav", "user": "Yug", "size": 99604, "width": 0, "height": 0, "duration": 1.128798185941043, "url": "https://upload.wikimedia.org/wikipedia/commons/5/5d/LL-Q150_%28fra%29-Yug-retour.wav", "descriptionurl": "https://commons.wikimedia.org/wiki/File:LL-Q150_(fra)-Yug-retour.wav", "descriptionshorturl": "https://commons.wikimedia.org/w/index.php?curid=104350594", "mime": "audio/wav", "ns": 6, "title": "File:LL-Q150 (fra)-Yug-retour.wav" } |
Commons > API:Allimages | List of 500 files prifixed by 'LL-Q150_(fra)', aka French language files, sorted by name, with username, mime, size and url | { "name": "LL-Q150_(fra)-Yug-retour.wav", "user": "Yug", "size": 99604, "width": 0, "height": 0, "duration": 1.128798185941043, "url": "https://upload.wikimedia.org/wikipedia/commons/5/5d/LL-Q150_%28fra%29-Yug-retour.wav", "descriptionurl": "https://commons.wikimedia.org/wiki/File:LL-Q150_(fra)-Yug-retour.wav", "descriptionshorturl": "https://commons.wikimedia.org/w/index.php?curid=104350594", "mime": "audio/wav", "ns": 6, "title": "File:LL-Q150 (fra)-Yug-retour.wav" } |
Commons > API:Allimages | List of 500 files prefixed by 'LL-Q150_(fra)-Yug', aka French language files by user:Yug, sorted by name, with username, mime, size and url | { "name": "LL-Q150_(fra)-Yug-retour.wav", "user": "Yug", "size": 99604, "width": 0, "height": 0, "duration": 1.128798185941043, "url": "https://upload.wikimedia.org/wikipedia/commons/5/5d/LL-Q150_%28fra%29-Yug-retour.wav", "descriptionurl": "https://commons.wikimedia.org/wiki/File:LL-Q150_(fra)-Yug-retour.wav", "descriptionshorturl": "https://commons.wikimedia.org/w/index.php?curid=104350594", "mime": "audio/wav", "ns": 6, "title": "File:LL-Q150 (fra)-Yug-retour.wav" } |
Commons > API:Logevents | List of 500 log events by User:Yug, type upload/upload, from 2022-01-01 and before | { "logid": 310250995, "ns": 6, "title": "File:LL-Q150 (fra)-Yug-retour.wav", "pageid": 104350594, "logpage": 104350594, "params": { "img_sha1": "annmkt852o46z5icpp2thdzyei7fla1", "img_timestamp": "2021-04-25T22:08:17Z" }, "type": "upload", "action": "upload", "user": "Yug", "timestamp": "2021-04-25T22:08:17Z", "comment": "" } |
Commons > API:Opensearch | Search for files, prefixed with LL-Q140193 (bci)-Olivier Yao- , return in OpenSearch format |
[ "LL-Q140193 (bci)-Olivier Yao-", [ "File:LL-Q140193 (bci)-Olivier Yao-n\u0254n.wav", "File:LL-Q140193 (bci)-Olivier Yao-oto.wav" ], [ "", "" ], [ "https://commons.wikimedia.org/wiki/File:LL-Q140193_(bci)-Olivier_Yao-n%C9%94n.wav", "https://commons.wikimedia.org/wiki/File:LL-Q140193_(bci)-Olivier_Yao-oto.wav" ] ] |
Commons > API:Search | [https://commons.wikimedia.org/w/api.php?action=query&list=search&srlimit=100&srsearch=intitle:/LL-Q150.*-vert\.wav/&srnamespace=6&srwhat=text&srprop=timestamp&utf8=true Search via regex intitle:/LL-Q150.*-vert\.wav/
|
{ "ns": 6, "title": "File:LL-Q150 (fra)-Roll-Morton-vert.wav", "pageid": 70168118, "timestamp": "2021-08-23T12:22:30Z" }</> |
API pages
* API > Query ** API:Allimages ** API:Logevents ** API:Search