API post header change

By: Connor McGrath | Asked: 11/21/2022
ForumsCategory: General questionsAPI post header change
Connor McGrath asked 2 years ago
I am looking to use Formidable API to send data to a website 
The website requires an API key and TENANT ID...

I have been reading into documentation and have a very low understanding of PHP/WP and am wondering where this goes to ensure the header data is always passed when connecting to the specific URL

add_filter( 'frm_api_request_args', 'my_custom_frm_api_request_header', 10, 2 );
function my_custom_frm_api_request_header( $arg_array, $args ) {
if ( str_contains($args['url'],'Website.com' )) { // the full url where the request is being sent
$arg_array['headers']['X-API-KEY'] = 'IPKEY';
$arg_array['headers']['X-TENANT-ID'] = 'TENANTID';
}
return $arg_array;
}

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right