Skip to content
  • Why WPGetAPI?
  • Examples
  • Pricing
  • Plugins
    • PRO Plugin
    • API to Posts Plugin
    • OAuth 2.0 Plugin
  • Docs
  • Support
    • Frequently Asked Questions
    • Feature Request
    • Support Ticket
  • account_circle
PRO Plugin
Howdy! How can we help you?
  • Introduction

    • Quick Start
    • Frequently Asked Questions
    • Will this work with my API?
    • Understanding API docs
    • Step by Step Example
  • Setup

    • Setup Page
    • Endpoint Page
    • Parameters - Query String
    • Parameters - Headers
    • Parameters - Body POST
    • Shortcode
    • Template Tag
    • Gutenberg Block
  • Connecting your API

    • API Key in Headers
    • API Key in Query String
    • Authentication & Authorization
  • Output API Data

    • Format API to HTML
    • Format API to HTML Table
    • Format API to Image Gallery
    • Format JSON Data
  • Integrations

    • Send form data to API
    • WPForms to API
    • Gravity Forms to API
    • Contact Form 7 to API
    • WooCommerce to API
    • WooCommerce API Product Sync
    • wpDataTables to API
    • Connect WordPress to OpenAI
    • Connect RapidAPI to WordPress
    • Connect Zoho CRM to WordPress
    • Page Builders (Elementor, DIVI)
    • Formidable Forms to API
    • Elementor Form to API
    • JetFormBuilder to API
    • Fluent Forms to API
    • WS Form to API
    • Ninja Tables to API
    • Easy Digital Downloads(EDD) API Product Sync
    • Ultimate Member Forms to API
  • Tips & Tricks

    • Filters & Action Hooks
    • Code Snippets Plugin
    • Troubleshooting
    • Code Snippets
  • PRO Plugin

    • Installation
    • Actions
    • Tokens
    • Caching
    • Nested data
    • Chaining API calls
    • Dynamic Variables
    • Format API to HTML
    • Call API on user registration
    • Using AJAX to trigger API call
    • Base64 Encoding
    • Licensing
    • Filters & Action Hooks
  • OAuth 2.0 Plugin

    • Installation
    • How it works
    • Grant Type - Client Credentials
    • Grant Type - Authorization Code
    • Licensing
  • API to Posts Plugin

    • Installation
    • Getting Started
    • Multiple Endpoints
    • Mapping Fields
    • Filters & Action Hooks
    • Pagination
You should use the methods in this article if you are wanting to display the API response data to the user. We now have an easier method for sending WPForms data to APIs – view new article. The methods in this article still work perfectly fine, however the newer method is much easier to implement.

 

WPGetAPI can interact with WPForms to gather the data that is submitted through a form, and then use this data as a variable to send to any external API. All this can be done without writing a single line of code.

Method 1 – No Code

How it works

We create a form and embed this into our page and then within the Confirmations section of WPForms, we can add our WPGetAPI shortcode. Then within our endpoint settings, we add a token to capture the data from the form field(s).

We are setting up our API to retrieve a random quote from the Quotable API and this API has an option to retrieve quotes that are tagged with certain different categories.

So we will setup our form with a dropdown of some tags and then capture whatever tag is selected, and then return a quote from within that ‘tag’.

Step 1: Setup our form

Here is our simple form with a dropdown of some tags. Whatever tag we choose will be sent to the API.

Note the ID #2 of this field. This is what we use in the next steps to capture the tag.

Step 2: Setup the endpoint

Within our query string, we have the name of “tags” and our value will be (system:post:2) which is basically saying, “grab the value of the field with the ID of 2”. We know that our field ID is #2.

Step 3: Add the shortcode

Now we grab our shortcode from the endpoint settings page and paste this into the default confirmation of our form. Adding the shortcode here will trigger the call to the API only after the form is submitted.

We’ve also set the format to be HTML so that it looks pretty (and doesn’t display as ugly JSON data).

And we have used the “keys” parameter in the shortcode to only grab the “content” and the “author” fields. The returned data also contains dates, quote ID, length and other data that we don’t want to return.

See the results

Here we have the results of the form and our confirmation message, which is a random quote from our chosen tag.

And here is a look at the generated HTML.


Method 2 – some coding

We are using a different API for this example to get the current price of a cryptocurrency coin.

This method requires some PHP coding knowledge.

Step 1: Setup WPForms

We have set up our form with 1 simple text field:

  • Crypto Pairs – this is what we will use to send to our API (note the ID of the field is #1 as this will be used in our code)

Now we just need to add the shortcode [wpforms id=”7961″] to our page and it will display our form.

Step 2: Setup the Binance API

The settings for our Binance API are shown in the screenshot below and you can see that we are using the endpoint: https://api.binance.com/api/v3/avgPrice

Step 3: Process form and get data

We now need to add the following code into our themes functions.php file. This will basically get our form value, which will be a cryptocurrency pair and then send this as a query variable to the Binance API to retrieve the price. We are then modifying the output of the forms message to give us the price.

function wpf_dev_process_filter( $message, $form_data, $fields, $entry_id ) {
  
    // Only run on my form with ID = 7961
    if ( absint( $form_data['id'] ) !== 7961 ) {
        return $message;
    } 

	// Get the crypto pair symbol from the form
    $symbol = $fields['1']['value'];

	// call the binance api and retrieve the 'price' key
	$price = wpgetapi_endpoint( 'binance', 'price_of_coin', 
		array( 
		    'debug' => false, 
		    'query_variables' => 'symbol=' . $symbol, 
		),
		array(
			'price'
		)
	);

	// output our message to the user
	$message = 'Current '. $symbol . ' price is ' . $price;
    
    return $message;
 
}
add_filter( 'wpforms_frontend_confirmation_message', 'wpf_dev_process_filter', 10, 4 );

View the results

Now it is just a matter of testing our form to see the results, which will be the current live price of a cryptocurrency pair from Binance.

On this page
contact_support

Still not sure?

APIs can be daunting and sometimes downright confusing.

But we are here to help! Our support is amazing and we can assist you with any setup required and ensure your API integrations are a success!

Ask Us Anything

Connect your WordPress website to external APIs without writing a single line of code. Send data from WordPress to your API or display data from your API within WordPress.

Support

  • Documentation
  • Support Ticket
  • Refund Policy
  • Contact Us
  • About Us
  • Affiliates

Articles

  • Quick Start Guide
  • WooCommerce Orders to API
  • WooCommerce API Products Sync
  • Contact Form 7 to API
  • WPForms to API
  • Gravity Forms to API
  • WordPress to RapidAPI

WordPress API Plugins

  • Free WPGetAPI Plugin
  • PRO Plugin
  • API to Posts Plugin Plugin
  • OAuth 2.0 Authorization Plugin

© 2025 WPGetAPI. All Rights Reserved.

"*" indicates required fields

Name*
This field is for validation purposes and should be left unchanged.