Search Results :

×

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

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



Get Free Trial

This plan helps you to integrate the external/ third-party REST API endpoints in WordPress such that you can perform operations on these External / Third-Party API endpoints on any of the WordPress or third-party plugin events by embedding the WordPress hook specific to the External API connection provided by this plugin. This plan also provides the feature to generate the custom REST endpoints in WordPress specific to your own complex SQL query.


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


miniorange img Directly fetch/get the data from a given REST API endpoint provided by third-party/external provider to display it on WordPress site

  • Suppose you have REST API endpoint provided by your API provider and want to fetch the data from the API provider side, then it can be very easy to fetch the data within seconds in whatever format you want directly to the WordPress backend by this plugin’s External APIs integration feature and these data can further be used to display on your WordPress site. Also you will be able to pass the real-time data to the API endpoint request. The plugin provides a WordPress hook which can be used whenever a call to External API is required.
  • Custom Rest API endpoint configuration

miniorange img Call External(Non-WordPress) RESTs API based on third-party plugin form submission events

  • Suppose you have a WordPress site integrated with any external/third-party provider and want to perform some actions like register/sign in/delete members on the third-party provider side or want to 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 etc forms submission for all these events. The plugin provides the WordPress hook specific to the External/third-party API connections made in the plugin. The hook can be easily integrated further dynamically with all the forms and run on the submission and also provide you the status of the API call.
  • Custom Rest API Call External

miniorange img Integrate External REST APIs on Payment gateways

  • Suppose you have a payment gateway like PayPal, Stripe or any other that are provided by Woocommerce, Wpforms, Stripe plugin or any other plugin embedded in your WordPress application and you want to 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, so this can easily be achieved by using the hook provided by our plugin for this external REST API endpoints integrated and this hook can be embedded directly into the gateways and run only based on the transaction status.
  • Custom Rest API Payment gateways

miniorange img Sync/Fetch data from Supplier’s external API into Woocommerce (Integrate External API into Woocommerce)

  • Suppose you have the external APIs provided by your Supplier’s(Distributor) and want to sync that real-time data fetched from these external APIs into Woocommerce to display these data/ products, then this plugin provides you with the feature to connect any external API into your WordPress and these API 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 will generate the WordPress developer hook specific to each External API Connection configured and saved in the plugin. You can use these developer hooks on your own to integrate these to the backend wherever that specific external API call is required. 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 Endpoints request with different Methods


    • 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 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 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 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.

    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