Skip to content

Commit 451f774

Browse files
authored
No longer providing examples for methods that don't return a valid API response, #PG-5170 (#49)
* No longer providing examples for methods that don't return a valid API response * update changelog * fix typo * Updated marketplace information
1 parent 81624bc commit 451f774

5 files changed

Lines changed: 47 additions & 4 deletions

File tree

Annotations/AnnotationGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -933,7 +933,7 @@ protected function getApplicableDemoExampleUrls(string $pluginName, string $meth
933933
];
934934

935935
// Don't build example URLs for anything that isn't the R in CRUD. E.g. No create, update, or delete.
936-
$notAllowedExampleUrlOperations = ['create', 'add', 'save', 'set', 'update', 'delete', 'remove', 'copy', 'duplicate'];
936+
$notAllowedExampleUrlOperations = ['create', 'add', 'save', 'set', 'update', 'delete', 'remove', 'copy', 'duplicate', 'generate'];
937937
foreach ($notAllowedExampleUrlOperations as $operation) {
938938
if (stripos($methodName, $operation) === 0) {
939939
return [];

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
## Changelog
2+
5.0.1 - 25/05/2026
3+
- Added fix for endpoints that don't return valid API responses
4+
25
5.0.0
36
- Initial release of ApiReference plugin

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22

33
## Description
44

5+
The API Reference plugin generates an OpenAPI (Swagger) specification from Matomo API definitions and supported plugin metadata.
6+
57
As APIs and plugins expose additional metadata, developers can browse available API endpoints, explore request parameters and response formats, and test API requests directly from the documentation interface.
68

79
### Features include:
810

911
* Interactive Swagger/OpenAPI-based API documentation
10-
* Searchable API methods and endpoints
1112
* Request and response schema documentation
1213
* Parameter descriptions and example requests
1314
* Improved navigation and API discoverability

docs/faq.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
## Why is the OpenAPI specification file not generated?
2+
3+
This can happen if the API Reference plugin is disabled, the Matomo cache has not been cleared, or the API specification generation process encountered an error.
4+
5+
Try the following:
6+
7+
- Ensure the API Reference plugin is installed and activated.
8+
- Clear the Matomo cache.
9+
- Check your server logs for PHP or permission errors.
10+
- Verify that the Matomo instance can write generated files to the configured directory.
11+
- Ensure all required plugins and dependencies are enabled.
12+
13+
The specification files are generated daily using a scheduled Matomo task. To check when this task is scheduled to run next, use the TasksTimetable plugin.
14+
15+
You can manually generate the specification files using the following command:
16+
17+
18+
The initial generation process may take some time to complete, depending on the number of installed plugins.
19+
20+
21+
```bash
22+
core:run-scheduled-tasks "Piwik\Plugins\ApiReference\Tasks.generateConfiguredPluginSpecs"
23+
```
24+
25+
## Can I still see the legacy API reference page?
26+
27+
Yes. The legacy API reference remains available for compatibility and migration purposes while transitioning to the new API documentation.
28+
29+
## Why do some request or response schemas appear incomplete?
30+
31+
The API Reference plugin generates request and response examples using data available in your Matomo instance. As a result, some response examples may appear incomplete if there is limited or no matching data available for a specific API request.
32+
33+
Not all API methods include response examples. Response examples are primarily generated for API methods that retrieve data from Matomo.
34+
35+
## Does the API Reference plugin replace existing Matomo APIs?
36+
37+
No. The plugin modernises the API documentation experience while remaining compatible with existing Matomo APIs and integrations.
38+
39+
Existing API endpoints and integrations continue to function normally.

plugin.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "ApiReference",
3-
"description": "Generate and view API documentation for Matomo in the OpenAPI format.",
4-
"version": "5.0.0",
3+
"description": "Modern interactive API documentation for Matomo based on OpenAPI (Swagger). Explore endpoints, parameters, and responses directly in your browser. ",
4+
"version": "5.0.1",
55
"theme": false,
66
"keywords": [
77
"API",

0 commit comments

Comments
 (0)