• I’m curious as to how to go about connecting to a company’s API through WordPress. Basically a friend has a website where a customer fills out an application. Upon submit, it connects to an API of a loan company and shows up in her loan company’s back end. Is WordPress even capable of doing this? I’ve never done anything like this. Here’s an example of the API..

    ————————————————

    GET /api/v1/loans/{loan_id}

    GET /api/v1/clients/{client_id}/loans

    POST /api/v1/clients/{client_id}/loans

    Description

    Allows you to create or retrieve loan accounts for clients. You can also look up loans by their state, by a branch or by a credit officer to which the loans are assigned to. Loans may be retrieved directly or from a client to which they belong.

    Methods

    GET and POST

    ——————————————————-

    Any help would be appreciated.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Yes, easy to do.
    You put your code into a plugin and access it using shortcodes.
    This plugin has examples of using forms to capture data that gets submitted to the server, in your case this would be the API.
    https://wordpress.org/plugins/wp-csv-to-database/
    Using shortcodes here:
    https://codex.wordpress.org/Shortcode_API

    Thread Starter unpredict2ble

    (@unpredict2ble)

    Awesome! I’m going to go and check it out and see if I can get it to work. Thanks so much for pointing me in the right direction. I’ll be in touch if I seek more help. Thanks again!

    Thread Starter unpredict2ble

    (@unpredict2ble)

    So i need to know plugin development?

    So i need to know plugin development?

    Yes. This would require at least basic development skills.

    Not sure that there is that much to know.
    I am sure there is a doc somewhere, not sure I have read it. Found it now, on this page: https://codex.wordpress.org/Main_Page
    Is a section “Write a Plugin” with three parts:
    https://codex.wordpress.org/Writing_a_Plugin
    https://codex.wordpress.org/Plugin_API
    https://codex.wordpress.org/Plugin_Resources

    When I started I had much more experience reading PHP than writing it. Please read the sample that launched me:
    https://wordpress.org/plugins/wp-csv-to-database/
    Yes it has nearly 700 lines, but spend 5 minutes scrolling through it, plant memories like “so that is how xxx happens”, so that you can get back to it later.
    You will see that there is a php file with the same name as the directory, so give your plugin a distinct name.
    It is possible that you don’t need any options or configuration for the plugin, so all that can get removed.

    //your shorcode stuff need not have anything to do with much else, may I suggest
    // something like this:
    
    class ABC_class {
    	private $varA;	//all the classes private variables
    	private $varB;
    	public function __construct() {
    		$this->varA = "";
    		$this->reset();
    	}
    	private function reset() {
    		$this->varB = "";
    	}
    	private function support_fn() {
    	}
    	public function do_foobar() {
    		//the shortcode gets done here
    	}
    }
    
    //[foobar]
    function foobar_func( $atts ){
    	//supply custom loan API
    	$mru = new ABC_class();
    	$mru->do_foobar();
    }
    add_shortcode( 'foobar', 'foobar_func' );
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Connecting To Loan Company API’ is closed to new replies.