Skip to content

Initial implementation of API endpoint info export#17

Merged
snake14 merged 3 commits into
5.x-devfrom
PG-4625-extract-API-endpoint-data
Oct 28, 2025
Merged

Initial implementation of API endpoint info export#17
snake14 merged 3 commits into
5.x-devfrom
PG-4625-extract-API-endpoint-data

Conversation

@snake14
Copy link
Copy Markdown
Contributor

@snake14 snake14 commented Oct 22, 2025

Description

This introduces a new command which exports the essential data about each public API endpoint for a specific plugin. There will be more PRs to refine things further.

Issue No

PG-4625

Steps to Replicate the Issue

  1. Check out this branch.
  2. Run the command for the plugin, like ddev matomo:console openapidocs:extract-api-method-info --plugin=AbTesting.
  3. See the JSON output containing info for each API endpoint.
  4. You can also run the command using the --not-dry-run option to see the output written to tmp file.

Checklist

  • [✔] Tested locally or on demo2/demo3?
  • [✖] New test case added/updated?
  • [NA] Are all newly added texts included via translation?
  • [NA] Are text sanitized properly? (Eg use of v-text v/s v-html for vue)
  • [NA] Version bumped?

@snake14 snake14 added the Needs Review For pull requests that need a code review. label Oct 22, 2025
@snake14 snake14 requested a review from a team October 22, 2025 04:54
$methodInfoArray = array_merge($methodInfoArray, $result);
}
}
$methodInfoString = json_encode($methodInfoArray);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes it more readable for file

Suggested change
$methodInfoString = json_encode($methodInfoArray);
$methodInfoString = json_encode($methodInfoArray, JSON_PRETTY_PRINT);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AltamashShaikh I might hold off on that change for now as it would make the file larger and I'm already worried about the file size when we try exporting all endpoints for the entire Matomo application/plugins.

Copy link
Copy Markdown
Contributor

@AltamashShaikh AltamashShaikh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works fine for me, I can see all the public methods and getExperimentsWithReports being excluded due to @hide

@snake14 snake14 merged commit b00031f into 5.x-dev Oct 28, 2025
7 checks passed
@snake14 snake14 deleted the PG-4625-extract-API-endpoint-data branch October 28, 2025 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Review For pull requests that need a code review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants