This feature is only available in the Pro Plugin.
Sending dynamic variables in the body is possible using the body_variables parameter.
Using Template Tag
Here is how we would dynamically send data into the body – sometimes called post fields. This example simply uses a username and password array.
// the data we are sending
$fields = array( 'username' => $username, 'password' => $password );
// call the API using the wpgetapi_endpoint() template tag
$data = wpgetapi_endpoint( 'myapi', 'myendpoint',
array(
'debug' => true,
'body_variables' => $fields,
)
);
// you now have the data stored within $data to use however you like
echo $data;
If your API requires that body fields be JSON encoded, then you can select this option from within your endpoint settings in the admin area.
Using Shortcode
Body variables are only available using the template tag.