Search Results :

×

Integrate External / Third-party REST API Endpoints into WordPress Site

Integrate External / Third-party REST API Endpoints into WordPress Site



Get Free Trial

Integrating external APIs with WordPress has become increasingly common for expanding functionality and enhancing user experiences. You can seamlessly call external APIs from WordPress, leveraging the WordPress API integration capabilities. This process involves utilizing the WordPress REST API to communicate with external API services, retrieving and displaying dynamic content directly on WordPress websites. You can fetch data from any external API and seamlessly use this information within your WordPress site. This integration not only enriches the website's offerings but also streamlines content management, allowing you to efficiently update and present real-time information to your audience.


This guide will help you to integrate external/ third-party APIs into WordPress. Perform operations on external/ third-party API endpoints on any WordPress or third-party plugin events. The plugin provides the option to embed the WordPress hook specific to the External API connection.


The guide also highlights the steps to generate custom REST endpoints in WordPress specific to your own complex SQL query.





Custom API for WordPress
By miniOrange

Custom API for WordPress plugin allows you to create WordPress APIs / custom endpoints / REST APIs. You can Fetch / Modify / Create / Delete data with an easy-to-use graphical interface.

Know More

1. Use cases for Custom REST API Plugin [Enterprise] version


miniorange img Directly Fetch Data From The REST API Endpoint To Display On WordPress Site


    Custom Rest API endpoint configuration
  • Imagine you have a REST API endpoint granted by your API provider and want to retrieve data from their side. This process can be effortlessly executed within seconds by employing our plugin's External APIs integration feature, directly into the WordPress backend, enabling an effective WordPress API integration. The retrieved data can then be seamlessly employed for showcasing purposes on your WordPress site.

    Additionally, you can share real-time data through API endpoint requests. For instances where an External API call is necessary, the plugin offers a dedicated WordPress hook that can be conveniently utilized.


miniorange img Call External (Non-WordPress) REST API For Form Submission Events


    Custom Rest API Call External
  • Suppose you have a WordPress site integrated with an External/Third-party provider. You now want to:

      1. Perform some actions like register/sign in/delete members on the third-party provider side .

      2. Fetch/update some other data by making the REST APIs call to the provider based on events like WPforms, Gravity Forms, Elementor, Contact-form7, or any other form submission.

    Our plugin provides WordPress API integration using a hook specific to external External/Third-party API connections. This hook can be easily integrated dynamically with all the forms, run on the submission, and provide the status of the API call.

miniorange img Integrate External REST APIs On Payment Gateways


    Custom Rest API Payment gateways
  • Let's say your WordPress website includes a payment gateway, such as PayPal, Stripe, or any other that is offered by Woocommerce, Wpforms, the Stripe plugin, or any other plugin.
    You want to call specific APIs to update the user status, membership level, etc. on the third-party API provider based on the payment status and amount. This is easily accomplished by using the hook provided by our plugin to call external API from WordPress. This hook can be embedded directly into the gateways and run only based on the transaction status.

miniorange img Sync/Fetch Data From The Supplier’s External API Into Woocommerce

  • Suppose you have external APIs provided by your supplier (distributor) and want to sync the real-time data fetched from these external APIs into Woocommerce to display these data/products.
    Our plugin provides you with the ability to use external API in WordPress site. These APIs can be called in the backend using the developer hooks to sync the real-time data with woocommerce products/items feeds and can be displayed on your site.

  • Click here to know more about WooCommerce Product Sync via APIs.

Note: Our plugin provides WordPress API integration using a hook specific to external External/Third-party API connections. This hook can be easily integrated dynamically with all the forms, run on the submission, and provide the status of the API call.In case you are also looking to integrate these developer hooks on the backend according to your requirements, please contact apisupport@xecurify.com to know more and let us know your complete requirements.


2. Steps to configure Custom REST API Endpoint requests with different


    • Go to the Connect To External API tab in the plugin to connect the External/third-party provider’s API endpoints to WordPress.
    • Enter the API name you want to give to the API connection. This API name should be unique as it will be used to connect it with WordPress
    • Choose the GET method from the Select Method dropdown.
    • In the External API textbox, put the API endpoint that you want to connect it with WordPress.
    • In the Headers, there are 2 text boxes - the left one is for the header name, and the right one is for the header value that needs to be passed.
      For example: If the header passed is in the format Authorization:Bearer then ‘Authorization’ will be added in the first textbox, and ‘Bearer should be put in the right textbox as shown in the diagram below.
    • Custom Rest API endpoint configuration
    • If your API expects multiple headers then you can click on the Add button right to it.
    • You can leave the Request Body field as empty as Request body is not used for GET requests.
    • Now click on the Execute button to test the API connection and fetch the response. You will receive the Attributes Table as shown below.
    • Custom Rest API test configuration
    • Now, once the test configuration is successful, you can select the particular response fields from the Select Response Fields dropdown that you want to use to integrate the External REST API endpoints to the WordPress. By default the ‘Select All’ field is selected.
    • Now you can click on the Save button to save the API connection.


    • Go to the Connect To External API tab in the plugin to connect the External/third-party provider’s API endpoints to WordPress.
    • Enter the API name you want to give to the API connection. This API name should be unique as it will be used to connect it with WordPress
    • Select the POST method from the Select Method dropdown.
    • In the External API textbox, put the API endpoint that you want to connect it with WordPress.
    • In the Headers, there are 2 text boxes - the left one is for the header name and the right one if for the header value that needs to be passed. For example : If the header passed to be in the format Authorization:Bearer <key/token> then the ‘Authorization’ will be added in the first textbox and ‘Bearer <key/token> should be put in the right textbox as shown in the diagram below.
    • Custom Rest API endpoint configuration
    • If the API provider expects the data needs to be sent in the body of the API endpoints request, then you can fill in the required details. There are 2 formats available in which you can send the data : x-www-form-urlencoded and JSON.
    • For the data to be sent in the body parameters in x-www-form-urlencoded format:
      • There are 2 text fields - first is to enter the key and second one is to enter the value.
      • For example→ If you have to pass the following body parameter ‘username→testuser’ then you need to put the ‘username’ in the key and ’testuser’ in the value field.
      • For the multiple key value pairs that need to be passed in the request body of the API endpoint request, you can click on the Add button.
    • For the data to be sent in the body parameters in JSON format:
      • You need to select the JSON from the dropdown corresponding to the Request Body option. And you need to pass the data in JSON format as shown below.
      • Custom Rest API json configuration
      • Now click on the Execute button to test the API connection and fetch the response. You will receive the Attributes Table as shown below.
      Custom Rest API test configuration
    • Now, once the test configuration is successful, you can select the particular response fields from the Select Response Fields dropdown that you want to use to integrate the External REST API endpoints to the WordPress. By default the ‘Select All’ field is selected.
    • Now you can click on the Save button to save the API connection.

    • Go to the Connect To External API tab in the plugin to connect the External/third-party provider’s API endpoints to WordPress.
    • Enter the API name you want to give to the API connection. This API name should be unique as it will be used to connect it with WordPress
    • Select the PUT method from the Select Method dropdown.
    • In the External API textbox, put the API endpoint that you want to connect it with WordPress.
    • In the Headers, there are 2 text boxes - the left one is for the header name and the right one if for the header value that needs to be passed. For example : If the header passed to be in the format Authorization:Bearer <key/token> then the ‘Authorization’ will be added in the first textbox and ‘Bearer <key/token> should be put in the right textbox as shown in the diagram below.
    • Custom Rest API endpoint configuration
    • If the API provider expects the data needs to be sent in the body of the API endpoints request, then you can fill in the required details. There are 2 formats available in which you can send the data : x-www-form-urlencoded and JSON.
    • For the data to be sent in the body parameters in x-www-form-urlencoded format:
      • There are 2 text fields - first is to enter the key and second one is to enter the value.
      • For example→ If you have to pass the following body parameter ‘username→testuser’ then you need to put the ‘username’ in the key and ’testuser’ in the value field.
      • For the multiple key value pairs that need to be passed in the request body of the API endpoint request, you can click on the Add button.
    • For the data to be sent in the body parameters in JSON format:
      • You need to select the JSON from the dropdown corresponding to the Request Body option. And you need to pass the data in JSON format as shown below.
      • Custom Rest API json configuration
      • Now click on the Execute button to test the API connection and fetch the response. You will receive the Attributes Table as shown below.
      Custom Rest API test configuration
    • Now, once the test configuration is successful, you can select the particular response fields from the Select Response Fields dropdown that you want to use to integrate the External REST API endpoints to the WordPress. By default the ‘Select All’ field is selected.
    • Now you can click on the Save button to save the API connection.

    • Go to the Connect To External API tab in the plugin to connect the External/third-party provider’s API endpoints to WordPress.
    • Enter the API name you want to give to the API connection. This API name should be unique as it will be used to connect it with WordPress
    • Select the DELETE method from the Select Method dropdown.
    • In the External API textbox, put the API endpoint that you want to connect it with WordPress.
    • In the Headers, there are 2 text boxes - the left one is for the header name and the right one if for the header value that needs to be passed. For example : If the header passed to be in the format Authorization:Bearer <key/token> then the ‘Authorization’ will be added in the first textbox and ‘Bearer <key/token> should be put in the right textbox as shown in the diagram below.
    • Custom Rest API endpoint configuration
    • If the API provider expects the data needs to be sent in the body of the API endpoints request, then you can fill in the required details. There are 2 formats available in which you can send the data : x-www-form-urlencoded and JSON.
    • For the data to be sent in the body parameters in x-www-form-urlencoded format:
      • There are 2 text fields - first is to enter the key and second one is to enter the value.
      • For example→ If you have to pass the following body parameter ‘username→testuser’ then you need to put the ‘username’ in the key and ’testuser’ in the value field.
      • For the multiple key value pairs that need to be passed in the request body of the API endpoint request, you can click on the Add button.
    • For the data to be sent in the body parameters in JSON format:
      • You need to select the JSON from the dropdown corresponding to the Request Body option. And you need to pass the data in JSON format as shown below.
      • Custom Rest API json configuration
      • Now click on the Execute button to test the API connection and fetch the response. You will receive the Attributes Table as shown below.
      Custom Rest API test configuration
    • Now, once the test configuration is successful, you can select the particular response fields from the Select Response Fields dropdown that you want to use to integrate the External REST API endpoints to the WordPress. By default the ‘Select All’ field is selected.
    • Now you can click on the Save button to save the API connection.

    3. Generate Custom REST API endpoints using custom SQL in WordPress

    • To use this feature go to ‘Create Custom SQL API tab’ in the plugin.
    • Custom Rest API test configuration
    • For GET Method:
    • 
        Sample SQL query → Select * from custom_table NATURAL JOIN custom_table2 where ID="{{custom_param1}}";
        
        Sample API request format → 
        <Your domain>/wp-json/mo/v1/<api name>?custom_param1=2
        
                          
    • For POST Method:
    • 
        Sample SQL query → INSERT INTO custom_table (ID, name, email, status) VALUES ('{{custom_param1}}','{{custom_param2}}','{{custom_param3}}','{{custom_param4}}');
        
        Sample API request format → curl -d "custom_param1=2&custom_param2=testuser&custom_param3=testuser@gmail.com&custom_param4=1” -X POST <Your domain>/wp-json/mo/v1/<api name>
        
                          
    • For PUT Method:
    • 
        Sample SQL query→ UPDATE custom_table SET 
        ID='{{custom_param1}}',name='{{custom_param2}}',email='{{custom_param3}}',status='{{custom_param4}}' WHERE ID={{custom_param5}};
        
        
        Sample API request format → curl -d "custom_param1=2&custom_param2=testuser&custom_param3=testuser@yahoo.com&custom_param4=1&custom_param5=2" -X PUT <Your domain>/wp-json/mo/v1/<api name>
                          
    • For DELETE Method:
    • 
        Sample SQL query→ DELETE FROM custom_table WHERE ID={{custom_param1}};
        
        Sample API request format → curl -d "custom_param1=0" -X DELETE<Your domain>/wp-json/mo/v1/<api name>
        
                          

    Note 1:Please pass the arguments as per the sequence/order as mentioned in the above sample SQL query and sample API request examples.

    Note 2:The custom attribute passed in the query should be in the following format “custom_param<i>” where i is the integer value that starts from 1 and increases as the number of custom parameters increases in the SQL query and also should be passed in the incremental sequence as shown in the above examples.


    Additional Resources

    miniorange img  Request a demo of the plugin


    Get Full-featured Trial



     Thank you for your response. We will get back to you soon.

    Something went wrong. Please submit your query again

    Integrate the External / Third-party REST API Endpoints

    Need Help?

    Mail us on apisupport@xecurify.com for quick guidance(via email/meeting) on your requirement and our team will help you to select the best suitable solution/plan as per your requirement.

    Hello there!

    Need Help? We are right here!

    support
    Contact miniOrange Support
    success

    Thanks for your inquiry.

    If you dont hear from us within 24 hours, please feel free to send a follow up email to info@xecurify.com