0

I need insight into connecting a Wordpress with an external API.

This is the expected action needed to be carried out.

  1. A user tries to search on the Wordpress with four different forms fields (Parameters) i.e name, code, department, class

  2. Once the submit button is clicked, it is expected to trigger an API request to an external point e.g https://externalapi?id=123acode=OLY121department=CITclass=245

  3. The generate a response back on the Wordpress page.

Has any tried doing this before or there is a plugin to carry this out.

  • 1
    Have you tried using wp rest api documentation to see how you can achieve that? Check out this link developer.wordpress.org/rest-api – Ogundare Ibukun Nov 14 at 15:20
  • Plugin recommendations are off-topic because they can go out of date, but I would guess that there probably isn't a generic API plugin because each API is a little bit different about how it stores and formats data, and what request types it expects. You may want to try asking on StackOverflow as this is more of a PHP-specific question. Once you work out the PHP required, you can package it up in either a plugin or your theme, whichever makes more sense. – WebElaine Nov 14 at 16:27
  • @WebElaine As it is now, it's too broad for SO as well – Machavity Nov 14 at 17:02
  • you need to clarify in your question whether the external API you want to connect to is another WordPress site or something else. for the first you can setup REST routes, for the second you probably can just process the querystring and use it to form a request with wp_remote_get – majick Nov 15 at 5:35
  • Welcome to the Forum! If you can write your own Plugin, the solution would be to capture the search function on a page that uses your plugin features (perhaps via shortcode). Then perform a CURL connection to the external API. Finally draw the page contents with the results of your CURL connection where your Shortcode output should go. If you're not sure how to do something like that, I would have to suggest hiring somebody who does. I doubt you'll find a ready-made solution. Good luck! – Mike Baxter Nov 15 at 22:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.