Closed attackant closed 1 month ago
I think we should add a menu option in the Apple News post list (like we have for Download, which downloads the article JSON) which previews what would be sent to the API. Same idea as what you have above, except making it easier to access by putting it in the same place where users already download article JSON. That interface is already restricted to users with manage_options
by default (so, admins).
Sounds good, what release should this go in, do you think?
Closing since it's merged to the 2.5.0 branch, will be part of the release when it goes out
Description
Implement a debugging mechanism in the Apple News plugin that allows developers to easily preview the full API request data for a given post. The debugging feature should be easily accessible, but restricted to admin users only for security.
debug_api()
method to theApple_Push
class that outputs the API request data when a specific URL parameter (apple_news_debug
) is present and the current user is an admin.debug_api()
method should output the post ID for context, followed by the JSON article data, asset bundles, and post metadata. The output should be clearly separated and formatted for readability.apple_news_debug
parameter to preview API request data.To test this feature:
This debugging feature will be a valuable tool for plugin developers, making it much easier to diagnose API issues and validate the data being sent to Apple News.
Use Case
As a developer working on the Apple News plugin, I often need to see the exact data being sent to the Apple News API for a given post. This is necessary for validating the data and diagnosing any issues with the API requests. However, currently there's no easy way to inspect the full request payload, especially for data that's not included in the typical debug output, such as metadata added by custom rules.