Skip to content

Commit

Permalink
REST: Create REST API v1 release and enable with Wikibase extension
Browse files Browse the repository at this point in the history
Release notes added to 1.43 as this commit will be backported to the REL1_43 branch (see T378370)

Bug: T378455
Bug: T378175
Change-Id: If3844c596576a2610ab1f7f18fe04964140fde32
  • Loading branch information
outdooracorn committed Nov 1, 2024
1 parent cc436c7 commit 576406e
Show file tree
Hide file tree
Showing 34 changed files with 350 additions and 37 deletions.
4 changes: 2 additions & 2 deletions RELEASE-NOTES-1.43
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ https://www.mediawiki.org/wiki/Manual:Upgrading

==== Changed configuration ====

* (T12345) ...
* (T378175) The REST API is now enabled when the Wikibase repo extension is loaded

==== Removed configuration ====

Expand Down Expand Up @@ -55,7 +55,7 @@ https://www.mediawiki.org/wiki/Manual:Upgrading

=== REST API changes in 1.43 ===

* (T12345) ...
* (T378455) Wikibase REST API v1.0 has been released

=== Languages updated in 1.43 ===

Expand Down
302 changes: 302 additions & 0 deletions extension-repo.json
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,308 @@
]
}
},
"RestRoutes": [
{
"path": "/wikibase/v1/entities/items/{item_id}",
"method": "GET",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\GetItemRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/items",
"method": "POST",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\CreateItemRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/items/{item_id}",
"method": "PATCH",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\PatchItemRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/properties/{property_id}",
"method": "GET",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\GetPropertyRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/properties/{property_id}",
"method": "PATCH",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\PatchPropertyRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/items/{item_id}/statements",
"method": "POST",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\AddItemStatementRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/properties/{property_id}/statements",
"method": "POST",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\AddPropertyStatementRouteHandler::factory"
},
{
"path": "/wikibase/v1/statements/{statement_id}",
"method": "GET",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\GetStatementRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/items/{item_id}/statements/{statement_id}",
"method": "GET",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\GetItemStatementRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/properties/{property_id}/statements/{statement_id}",
"method": "GET",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\GetPropertyStatementRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/items/{item_id}/statements",
"method": "GET",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\GetItemStatementsRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/properties/{property_id}/statements",
"method": "GET",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\GetPropertyStatementsRouteHandler::factory"
},
{
"path": "/wikibase/v1/statements/{statement_id}",
"method": "PUT",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\ReplaceStatementRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/items/{item_id}/statements/{statement_id}",
"method": "PUT",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\ReplaceItemStatementRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/properties/{property_id}/statements/{statement_id}",
"method": "PUT",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\ReplacePropertyStatementRouteHandler::factory"
},
{
"path": "/wikibase/v1/statements/{statement_id}",
"method": "DELETE",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\RemoveStatementRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/items/{item_id}/statements/{statement_id}",
"method": "DELETE",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\RemoveItemStatementRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/properties/{property_id}/statements/{statement_id}",
"method": "DELETE",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\RemovePropertyStatementRouteHandler::factory"
},
{
"path": "/wikibase/v1/statements/{statement_id}",
"method": "PATCH",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\PatchStatementRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/items/{item_id}/statements/{statement_id}",
"method": "PATCH",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\PatchItemStatementRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/properties/{property_id}/statements/{statement_id}",
"method": "PATCH",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\PatchPropertyStatementRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/items/{item_id}/labels",
"method": "GET",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\GetItemLabelsRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/properties/{property_id}/labels",
"method": "GET",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\GetPropertyLabelsRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/items/{item_id}/labels/{language_code}",
"method": "GET",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\GetItemLabelRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/items/{item_id}/labels_with_language_fallback/{language_code}",
"method": "GET",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\GetItemLabelWithFallbackRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/properties/{property_id}/labels/{language_code}",
"method": "GET",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\GetPropertyLabelRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/properties/{property_id}/labels_with_language_fallback/{language_code}",
"method": "GET",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\GetPropertyLabelWithFallbackRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/items/{item_id}/labels/{language_code}",
"method": "PUT",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\SetItemLabelRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/properties/{property_id}/labels/{language_code}",
"method": "PUT",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\SetPropertyLabelRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/items/{item_id}/labels",
"method": "PATCH",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\PatchItemLabelsRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/properties/{property_id}/labels",
"method": "PATCH",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\PatchPropertyLabelsRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/items/{item_id}/labels/{language_code}",
"method": "DELETE",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\RemoveItemLabelRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/properties/{property_id}/labels/{language_code}",
"method": "DELETE",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\RemovePropertyLabelRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/items/{item_id}/descriptions",
"method": "GET",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\GetItemDescriptionsRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/items/{item_id}/descriptions",
"method": "PATCH",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\PatchItemDescriptionsRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/properties/{property_id}/descriptions",
"method": "PATCH",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\PatchPropertyDescriptionsRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/items/{item_id}/descriptions/{language_code}",
"method": "GET",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\GetItemDescriptionRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/items/{item_id}/descriptions_with_language_fallback/{language_code}",
"method": "GET",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\GetItemDescriptionWithFallbackRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/properties/{property_id}/descriptions/{language_code}",
"method": "GET",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\GetPropertyDescriptionRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/properties/{property_id}/descriptions_with_language_fallback/{language_code}",
"method": "GET",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\GetPropertyDescriptionWithFallbackRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/items/{item_id}/descriptions/{language_code}",
"method": "PUT",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\SetItemDescriptionRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/properties/{property_id}/descriptions/{language_code}",
"method": "PUT",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\SetPropertyDescriptionRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/items/{item_id}/descriptions/{language_code}",
"method": "DELETE",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\RemoveItemDescriptionRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/properties/{property_id}/descriptions/{language_code}",
"method": "DELETE",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\RemovePropertyDescriptionRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/items/{item_id}/aliases",
"method": "GET",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\GetItemAliasesRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/properties/{property_id}/descriptions",
"method": "GET",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\GetPropertyDescriptionsRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/properties/{property_id}/aliases",
"method": "GET",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\GetPropertyAliasesRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/items/{item_id}/aliases",
"method": "PATCH",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\PatchItemAliasesRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/properties/{property_id}/aliases",
"method": "PATCH",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\PatchPropertyAliasesRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/items/{item_id}/aliases/{language_code}",
"method": "GET",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\GetItemAliasesInLanguageRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/properties/{property_id}/aliases/{language_code}",
"method": "GET",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\GetPropertyAliasesInLanguageRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/items/{item_id}/aliases/{language_code}",
"method": "POST",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\AddItemAliasesInLanguageRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/properties/{property_id}/aliases/{language_code}",
"method": "POST",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\AddPropertyAliasesInLanguageRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/items/{item_id}/sitelinks",
"method": "GET",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\GetSitelinksRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/items/{item_id}/sitelinks",
"method": "PATCH",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\PatchSitelinksRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/items/{item_id}/sitelinks/{site_id}",
"method": "GET",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\GetSitelinkRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/items/{item_id}/sitelinks/{site_id}",
"method": "DELETE",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\RemoveSitelinkRouteHandler::factory"
},
{
"path": "/wikibase/v1/entities/items/{item_id}/sitelinks/{site_id}",
"method": "PUT",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\SetSitelinkRouteHandler::factory"
},
{
"path": "/wikibase/v1/openapi.json",
"method": "GET",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\GetOpenApiDocRouteHandler::factory"
},
{
"path": "/wikibase/v1/property-data-types",
"method": "GET",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\GetPropertyDataTypesHandler::factory"
}
],
"SpecialPages": {
"NewItem": {
"class": "Wikibase\\Repo\\Specials\\SpecialNewItem",
Expand Down
4 changes: 4 additions & 0 deletions repo/rest-api/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG {#wb_rest_api_changelog}

## Version 1.0

* Wikibase REST API v1 released

## Version 0.5

* Added label/description endpoints with language fallback ([T371605](https://phabricator.wikimedia.org/T371605))
Expand Down
4 changes: 3 additions & 1 deletion repo/rest-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

### Enable the REST API

To enable the production-ready routes, add the following line to your `LocalSettings.php` file:
**As of REL1_44, the Wikibase REST API is enabled when the Wikibase repo extension is loaded**

To enable the production-ready routes, in versions prior to REL1_44, add the following line to your `LocalSettings.php` file:

```php
$wgRestAPIAdditionalRouteFiles[] = 'extensions/Wikibase/repo/rest-api/routes.json';
Expand Down
5 changes: 5 additions & 0 deletions repo/rest-api/docs/adr/0007_work_in_progress_endpoints.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# 7) Wikibase REST API work-in-progress endpoints {#rest_adr_0007}

Date: 2023-02-01
Updated: 2024-11-01

## Status

Expand Down Expand Up @@ -35,6 +36,10 @@ How to manage new features or changes to existing endpoints are outside the scop
- Wikibase admins that create their own route file risk broken routes if our factories change.
- We will be able to add new routes to the OpenAPI definition before they are ready, while still indicating the status of each route.

## November 2024 Changes

* With the REST API v1 release, all production ready endpoints are now defined in the `extension-repo.json` file and enabled when the Wikibase repo extension is loaded. Therefore, once the v0 endpoints are deprecated, there will be no need for the `routes.json` file. In development endpoints will still be defined in the `route.dev.json` file.

[doc.wikimedia.org]: https://doc.wikimedia.org
[`extension-repo.json`]: https://gerrit.wikimedia.org/g/mediawiki/extensions/Wikibase/+/758065e4967fcb9575a06302a80a84ccb762d373/extension-repo.json
[OpenAPI Definition]: https://swagger.io/specification/
Expand Down
2 changes: 1 addition & 1 deletion repo/rest-api/docs/loaders/openapi-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = function ( _ ) {

done( null, JSON.stringify( {
...spec,
servers: [ { url: baseUrl + '/wikibase/v0'} ]
servers: [ { url: baseUrl + '/wikibase/v1' } ]
} ) )
} )
.catch( ( { message } ) => done( message ) );
Expand Down
2 changes: 1 addition & 1 deletion repo/rest-api/routes.dev.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[
{
"path": "/wikibase/v0/entities/properties",
"path": "/wikibase/v1/entities/properties",
"method": "POST",
"factory": "Wikibase\\Repo\\RestApi\\RouteHandlers\\CreatePropertyRouteHandler::factory"
}
Expand Down
2 changes: 1 addition & 1 deletion repo/rest-api/specs/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,6 @@
}
],
"servers": [
{ "url": "https://wikibase.example/w/rest.php/wikibase/v0" }
{ "url": "https://wikibase.example/w/rest.php/wikibase/v1" }
]
}
Loading

0 comments on commit 576406e

Please sign in to comment.