What are POST fields
POST fields (sometimes called body fields), are key/value pairs of data that are sent within the body of the request to your API, for your API to process. They will only work and be sent when you have set the Request Method to POST.
POST fields are sent as key/value pairs and are separated by a colon (:) such as this: username: johncitizen
Within your API’s documentation, it should tell you which POST fields (if any) you need to provide.
How to add POST fields
Adding POST fields is possible by simply adding the name/value pairs into the Body POST Fields within the endpoint, as shown below.
The plugin automatically adds the colon that is required to seperate the key:value, so adding these parameters as shown above will create and send the following POST fields:
username: johncitizen password: hello123!
You can also choose to encode the body fields using the option shown in the image above. Your API documentation should mention if this is required.
When to use POST fields
You should use POST fields when your API documentation says so!
Using POST fields is only used for POST requests but again, refer to your API’s documentation to know if you need to send POST fields..
Sometimes you may need to use dynamic variables in the POST fields.
This means that you may need to, for example send a user_id value in the POST fields depending on which user is logged in. This is possible when using the Pro Plugin, which adds a new attribute to the shortcode and template tag.
Here is a guide for using dynamic variables in POST fields.