• Hello, I need to make new plugin for Sync between Epicor System and wordpress website.
    So my purpose is just that customers can see details of their order processing on wordpress website from Epicor System.
    As you know, Epicor is customer and order management system physical service.
    Epicor support team provide me rest API document for this.
    I did not well about rest API integration with wordpress.
    How can send request data from WordPress to Epicor? Who have experiences on this?
    Who can guide me about this problem?
    Thank you for your help.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    You can use any PHP code that can send appropriate HTTPS requests. file_get_contents() for example. However, I suggest using the WP_Http class to make such requests.

    To present the data obtained from the API to the user, you have a few choices. You could hijack the normal template loading process through the “template_include” filter. Have it load a template from your plugin instead. Or you could generate output through either shortcode or custom block which the page author would include in their normal page content.

    Thread Starter solvafabiola

    (@solvafabiola)

    Thank you for your reply. By the way, do you have any sample plugin that have functions what I want?
    If you have experiences about this function, let me know how to start this.
    Please let me know
    thank you.

    Moderator bcworkz

    (@bcworkz)

    There’s a lot of variability in how you might request data from an API. It depends on the API’s specification. Making a GET request is pretty straight forward. You construct the required URL and use it in the get() method. Here’s some example code to make a GET request to Google’s geocoding API:

            //assume the client app sent a POST request with an "address" field among other data
    	$addr = sanitize_text_field( urldecode( $_POST['address']));
    	$url = 'https://maps.googleapis.com/maps/api/geocode/json?address='.$addr.'&key=your-api-key-goes-here';
    	$http = new WP_Http();
    	$response = $http->get( $url );
    	echo $response['body'];

    Making POST requests is more complicated, but similar in general concept.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Rest API Plugin Development’ is closed to new replies.