
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
wb-rest-api-client
Advanced tools
This is an auto-generated Wikibase REST API client library using the API’s OpenAPI document. It is generated via OpenAPITools/openapi-generator
and WMDE does not provide any guarantees about the library functionality.
This snippet shows a basic usage example, including how to set the User-Agent
header, which should be configured according to the Wikimedia User-Agent policy.
import { ApiClient, LabelsApi } from '@wmde/wikibase-rest-api';
const apiClient = new ApiClient( 'https://www.wikidata.org/w/rest.php//wikibase/v0' );
apiClient.defaultHeaders[ 'User-Agent' ] = '[custom user agent]';
console.log( await new LabelsApi( apiClient ).getItemLabel( 'Q42', 'en' ) );
Below you can find the automatically generated documentation:
WbRestApiClient - JavaScript client for wb-rest-api-client OpenAPI definition of Wikibase REST API This SDK is automatically generated by the OpenAPI Generator project:
To publish the library as a npm, please follow the procedure in "Publishing npm packages".
Then install it via:
npm install wb-rest-api-client --save
Finally, you need to build the module:
npm run build
To use the library locally without publishing to a remote npm registry, first install the dependencies by changing into the directory containing package.json
(and this README). Let's call this JAVASCRIPT_CLIENT_DIR
. Then run:
npm install
Next, link it globally in npm with the following, also from JAVASCRIPT_CLIENT_DIR
:
npm link
To use the link you just defined in your project, switch to the directory you want to use your wb-rest-api-client from, and run:
npm link /path/to/<JAVASCRIPT_CLIENT_DIR>
Finally, you need to build the module:
npm run build
If the library is hosted at a git repository, e.g.https://github.com/GIT_USER_ID/GIT_REPO_ID then install it via:
npm install GIT_USER_ID/GIT_REPO_ID --save
The library also works in the browser environment via npm and browserify. After following
the above steps with Node.js and installing browserify with npm install -g browserify
,
perform the following (assuming main.js is your entry file):
browserify main.js > bundle.js
Then include bundle.js in the HTML pages.
Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:
module: {
rules: [
{
parser: {
amd: false
}
}
]
}
Please follow the installation instruction and execute the following JS code:
var WbRestApiClient = require('wb-rest-api-client');
var api = new WbRestApiClient.AliasesApi()
var itemId = "Q24"; // {String} The ID of the required Item
var languageCode = "en"; // {String} The requested resource language
var addItemAliasesInLanguageRequest = new WbRestApiClient.AddItemAliasesInLanguageRequest(); // {AddItemAliasesInLanguageRequest} Payload containing a list of Wikibase aliases in the specified language and edit metadata
var opts = {
'ifNoneMatch': ["null"], // {[String]} Conditionally perform the request only if the resource has been modified since the specified entity revision numbers
'ifModifiedSince': "Sat, 06 Jun 2020 16:38:47 GMT", // {String} Conditionally perform the request only if the resource has been modified after the specified date
'ifMatch': ["null"], // {[String]} Conditionally perform the request only if the resource has not been modified since one of the specified entity revision numbers
'ifUnmodifiedSince': "Sat, 06 Jun 2020 16:38:47 GMT", // {String} Conditionally perform the request only if the resource has not been modified after the specified date
'authorization': "Bearer mF_9.B5f-4.1JqM" // {String} Make authenticated request using a provided bearer token
};
api.addItemAliasesInLanguage(itemId, languageCode, addItemAliasesInLanguageRequest, opts).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
});
All URIs are relative to https://wikibase.example/w/rest.php/wikibase/v0
Class | Method | HTTP request | Description |
---|---|---|---|
WbRestApiClient.AliasesApi | addItemAliasesInLanguage | POST /entities/items/{item_id}/aliases/{language_code} | Create / Add an Item's aliases in a specific language |
WbRestApiClient.AliasesApi | addPropertyAliasesInLanguage | POST /entities/properties/{property_id}/aliases/{language_code} | Create / Add a Property's aliases in a specific language |
WbRestApiClient.AliasesApi | getItemAliases | GET /entities/items/{item_id}/aliases | Retrieve an Item's aliases |
WbRestApiClient.AliasesApi | getItemAliasesInLanguage | GET /entities/items/{item_id}/aliases/{language_code} | Retrieve an Item's aliases in a specific language |
WbRestApiClient.AliasesApi | getPropertyAliases | GET /entities/properties/{property_id}/aliases | Retrieve a Property's aliases |
WbRestApiClient.AliasesApi | getPropertyAliasesInLanguage | GET /entities/properties/{property_id}/aliases/{language_code} | Retrieve a Property's aliases in a specific language |
WbRestApiClient.AliasesApi | patchItemAliases | PATCH /entities/items/{item_id}/aliases | Change an Item's aliases |
WbRestApiClient.AliasesApi | patchPropertyAliases | PATCH /entities/properties/{property_id}/aliases | Change a Property's aliases |
WbRestApiClient.DescriptionsApi | deleteItemDescription | DELETE /entities/items/{item_id}/descriptions/{language_code} | Delete an Item's description in a specific language |
WbRestApiClient.DescriptionsApi | deletePropertyDescription | DELETE /entities/properties/{property_id}/descriptions/{language_code} | Delete a Property's description in a specific language |
WbRestApiClient.DescriptionsApi | getItemDescription | GET /entities/items/{item_id}/descriptions/{language_code} | Retrieve an Item's description in a specific language |
WbRestApiClient.DescriptionsApi | getItemDescriptionWithFallback | GET /entities/items/{item_id}/descriptions_with_language_fallback/{language_code} | Retrieve an Item's description in a specific language, with language fallback |
WbRestApiClient.DescriptionsApi | getItemDescriptions | GET /entities/items/{item_id}/descriptions | Retrieve an Item's descriptions |
WbRestApiClient.DescriptionsApi | getPropertyDescription | GET /entities/properties/{property_id}/descriptions/{language_code} | Retrieve a Property's description in a specific language |
WbRestApiClient.DescriptionsApi | getPropertyDescriptionWithFallback | GET /entities/properties/{property_id}/descriptions_with_language_fallback/{language_code} | Retrieve a Property's description in a specific language, with language fallback |
WbRestApiClient.DescriptionsApi | getPropertyDescriptions | GET /entities/properties/{property_id}/descriptions | Retrieve a Property's descriptions |
WbRestApiClient.DescriptionsApi | patchItemDescriptions | PATCH /entities/items/{item_id}/descriptions | Change an Item's descriptions |
WbRestApiClient.DescriptionsApi | patchPropertyDescriptions | PATCH /entities/properties/{property_id}/descriptions | Change a Property's descriptions |
WbRestApiClient.DescriptionsApi | replaceItemDescription | PUT /entities/items/{item_id}/descriptions/{language_code} | Add / Replace an Item's description in a specific language |
WbRestApiClient.DescriptionsApi | replacePropertyDescription | PUT /entities/properties/{property_id}/descriptions/{language_code} | Add / Replace a Property's description in a specific language |
WbRestApiClient.ItemsApi | addItem | POST /entities/items | Create a Wikibase Item |
WbRestApiClient.ItemsApi | getItem | GET /entities/items/{item_id} | Retrieve a single Wikibase Item by ID |
WbRestApiClient.ItemsApi | patchItem | PATCH /entities/items/{item_id} | Change a single Wikibase Item by ID |
WbRestApiClient.LabelsApi | deleteItemLabel | DELETE /entities/items/{item_id}/labels/{language_code} | Delete an Item's label in a specific language |
WbRestApiClient.LabelsApi | deletePropertyLabel | DELETE /entities/properties/{property_id}/labels/{language_code} | Delete a Property's label in a specific language |
WbRestApiClient.LabelsApi | getItemLabel | GET /entities/items/{item_id}/labels/{language_code} | Retrieve an Item's label in a specific language |
WbRestApiClient.LabelsApi | getItemLabelWithFallback | GET /entities/items/{item_id}/labels_with_language_fallback/{language_code} | Retrieve an Item's label in a specific language, with language fallback |
WbRestApiClient.LabelsApi | getItemLabels | GET /entities/items/{item_id}/labels | Retrieve an Item's labels |
WbRestApiClient.LabelsApi | getPropertyLabel | GET /entities/properties/{property_id}/labels/{language_code} | Retrieve a Property's label in a specific language |
WbRestApiClient.LabelsApi | getPropertyLabelWithFallback | GET /entities/properties/{property_id}/labels_with_language_fallback/{language_code} | Retrieve a Property's label in a specific language, with language fallback |
WbRestApiClient.LabelsApi | getPropertyLabels | GET /entities/properties/{property_id}/labels | Retrieve a Property's labels |
WbRestApiClient.LabelsApi | patchItemLabels | PATCH /entities/items/{item_id}/labels | Change an Item's Labels |
WbRestApiClient.LabelsApi | patchPropertyLabels | PATCH /entities/properties/{property_id}/labels | Change a Property's Labels |
WbRestApiClient.LabelsApi | replaceItemLabel | PUT /entities/items/{item_id}/labels/{language_code} | Add / Replace an Item's label in a specific language |
WbRestApiClient.LabelsApi | replacePropertyLabel | PUT /entities/properties/{property_id}/labels/{language_code} | Add / Replace a Property's label in a specific language |
WbRestApiClient.OpenAPIDocumentApi | getOpenApiDoc | GET /openapi.json | Retrieve the OpenAPI document |
WbRestApiClient.PropertiesApi | addProperty | POST /entities/properties | [WIP] Create a Wikibase Property |
WbRestApiClient.PropertiesApi | getProperty | GET /entities/properties/{property_id} | Retrieve a single Wikibase Property by ID |
WbRestApiClient.PropertiesApi | patchProperty | PATCH /entities/properties/{property_id} | Change a single Wikibase Property by ID |
WbRestApiClient.PropertyDataTypesApi | getPropertyDataTypes | GET /property-data-types | Retrieve the map of Property data types to value types |
WbRestApiClient.SitelinksApi | deleteSitelink | DELETE /entities/items/{item_id}/sitelinks/{site_id} | Delete an Item's Sitelink |
WbRestApiClient.SitelinksApi | getSitelink | GET /entities/items/{item_id}/sitelinks/{site_id} | Retrieve an Item's Sitelink |
WbRestApiClient.SitelinksApi | getSitelinks | GET /entities/items/{item_id}/sitelinks | Retrieve an Item's Sitelinks |
WbRestApiClient.SitelinksApi | patchSitelinks | PATCH /entities/items/{item_id}/sitelinks | Change an Item's Sitelinks |
WbRestApiClient.SitelinksApi | setSitelink | PUT /entities/items/{item_id}/sitelinks/{site_id} | Add / Replace an Item's Sitelink |
WbRestApiClient.StatementsApi | addItemStatement | POST /entities/items/{item_id}/statements | Add a new Statement to an Item |
WbRestApiClient.StatementsApi | addPropertyStatement | POST /entities/properties/{property_id}/statements | Add a new Statement to a Property |
WbRestApiClient.StatementsApi | deleteItemStatement | DELETE /entities/items/{item_id}/statements/{statement_id} | Delete a single Statement from an Item |
WbRestApiClient.StatementsApi | deletePropertyStatement | DELETE /entities/properties/{property_id}/statements/{statement_id} | Delete a single Statement from a Property |
WbRestApiClient.StatementsApi | deleteStatement | DELETE /statements/{statement_id} | Delete a single Statement |
WbRestApiClient.StatementsApi | getItemStatement | GET /entities/items/{item_id}/statements/{statement_id} | Retrieve a single Statement from an Item |
WbRestApiClient.StatementsApi | getItemStatements | GET /entities/items/{item_id}/statements | Retrieve Statements from an Item |
WbRestApiClient.StatementsApi | getPropertyStatement | GET /entities/properties/{property_id}/statements/{statement_id} | Retrieve a single Statement from a Property |
WbRestApiClient.StatementsApi | getPropertyStatements | GET /entities/properties/{property_id}/statements | Retrieve Statements from a Property |
WbRestApiClient.StatementsApi | getStatement | GET /statements/{statement_id} | Retrieve a single Statement |
WbRestApiClient.StatementsApi | patchItemStatement | PATCH /entities/items/{item_id}/statements/{statement_id} | Change elements of a single Statement of an Item |
WbRestApiClient.StatementsApi | patchPropertyStatement | PATCH /entities/properties/{property_id}/statements/{statement_id} | Change elements of a single Statement of a Property |
WbRestApiClient.StatementsApi | patchStatement | PATCH /statements/{statement_id} | Change elements of a single Statement |
WbRestApiClient.StatementsApi | replaceItemStatement | PUT /entities/items/{item_id}/statements/{statement_id} | Replace a single Statement of an Item |
WbRestApiClient.StatementsApi | replacePropertyStatement | PUT /entities/properties/{property_id}/statements/{statement_id} | Replace a single Statement of a Property |
WbRestApiClient.StatementsApi | replaceStatement | PUT /statements/{statement_id} | Replace a single Statement |
Endpoints do not require authorization.
FAQs
Wikibase REST API Client
The npm package wb-rest-api-client receives a total of 11 weekly downloads. As such, wb-rest-api-client popularity was classified as not popular.
We found that wb-rest-api-client demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.