Open Morriz opened 3 weeks ago
Hi @Morriz
Or is that not possible because your plugin wraps many different endpoints with different behavior?
Are you referring to Try it
functionality?
If so, I think we can add a filter to add additional request payload conditionally.
I'll look into it this weekend.
@Morriz It looks like this can be done without adding an additional filter to this plugin.
You can use rest_pre_dispatch
filter.
Here's an example:
function my_custom_rest_request_headers($result, $server, $request) {
// Check if this is the specific route you want to modify
if ($request->get_route() === '/wc-admin/features') {
$params = $request->get_params();
$params['extra_data'] = 'AdditionalPayloadData';
$request->set_query_params($params);
}
return $result;
}
add_filter('rest_pre_dispatch', 'my_custom_rest_request_headers', 10, 3);
Please let me know if you need a different approach.
Thanks!
I am now just using one api key for all of wp's api as well as the plugin api's as it is shared....didn't know that ;p
I am now just using one api key for all of wp's api as well as the plugin api's as it is shared....didn't know that ;p
We can also add an option to use any authentication method defined in the openapi spec. I'll look into that.
Hi, how do we provide auth token for requests? Or is that not possible because your plugin wraps many different endpoints with different behavior?