MediaWiki REST API
Jump to navigation
Jump to search
A MediaWiki REST API is a REST interface that enables programmatic access to MediaWiki resources through HTTP requests to `/rest.php` endpoints.
- Context:
- It can (typically) handle HTTP methods including GET, POST, PUT, and HEAD.
- It can (typically) return responses in JSON format or HTML format.
- It can (typically) use HTTP status codes for error handling.
- It can (typically) require API authentication through user agent headers.
- It can (often) implement rate limiting for request management.
- It can (often) provide error responses with error details in JSON format.
- It can range from being a Basic REST Implementation to being an Advanced REST Implementation, depending on its feature support.
- It can range from being a Read-Only REST API to being a Full-Access REST API, depending on its access permissions.
- ...
- Example(s):
- MediaWiki REST Operations, such as:
- Resource Retrievals, such as:
- Page Content Query for wiki page access.
- Media File Query for file resource access.
- History Query for revision information.
- Resource Modifications, such as:
- Response Formats, such as:
- Resource Retrievals, such as:
- REST API Implementations, such as:
- Wikimedia REST API at `/api/rest_v1/`.
- Wikipedia REST API for English Wikipedia.
- ...
- MediaWiki REST Operations, such as:
- Counter-Example(s):
- MediaWiki Action API, which uses legacy API architecture.
- Direct Database Access, which bypasses API security.
- File System Interface, which lacks web service capability.
- Manual Edit Interface, which requires human interaction.
- See: REST Architecture, Web API, MediaWiki Software Engine, HTTP Protocol.
References
2024-12-23
- Perplexity.ai
- Question: What is the MediaWiki REST API, its features, implementation details, and versions? Include information about status codes, error handling, and rate limiting.
- Answer: The MediaWiki REST API is an interface that enables programmatic interaction with MediaWiki through HTTP requests to rest.php URLs, allowing developers to build applications and scripts for searching pages, retrieving media files, and exploring page history.
- Core Features:
- HTTP Methods:
- GET: Retrieve resources.
- POST: Create resources.
- PUT: Update or create resources.
- HEAD: Return HTTP headers without response data.
- Response Format:
- Returns data in JSON or HTML format.
- Content types vary by endpoint.
- HTTP Methods:
- Status Codes and Errors:
- Status Codes:
- Error Responses:
- Include JSON object with detailed information.
- Contain status code, reason, and translated messages.
- Implementation Details:
- Rate Limiting:
- Limit of 200 requests per second.
- Authentication:
- Requires unique User-Agent or Api-User-Agent header.
- Includes contact information.
- Rate Limiting:
- API Versions:
- API Types:
- Action API: Available at `/api.php` for all installations.
- REST API: Available at `/rest.php` for MediaWiki 1.35+.
- Wikimedia API: Available at `/api/rest` for Wikimedia projects.
- API Types:
- Core Features:
- Citations:
[1] https://www.mediawiki.org/wiki/API:REST_API [2] https://www.mediawiki.org/wiki/API:REST_API/Status_codes [3] https://www.mediawiki.org/wiki/Wikimedia_REST_API [4] https://www.mediawiki.org/wiki/API:REST_API/Extensions [5] https://wikiteq.com/post/using-mediawiki-api [6] https://www.mediawiki.org/wiki/API:Tutorial [7] https://wikimedia.org/api/rest_v1/ [8] https://www.mediawiki.org/wiki/API:REST_API/Reference [9] https://dev.to/zuplo/what-is-the-wikipedia-api-how-to-use-it-and-alternatives-j4o [10] https://www.youtube.com/watch?v=KlTrP6XYvEM