Ask your WordPress questions! Pay money and get answers fast! (more info)

Show external API in WordPress WordPress

  • SOLVED

I need to be able to display some pages of course software that offers an API to integrate into a website. However I have not used API's before, and do not really understand what I need to do.

I am wanting to use the API from this site https://admin.axcelerate.com.au/api (defined API link is in the left side menu)

And then display this on to the WordPress site.

I am advised that I need to use the API method rather than iframe.

Hopefully someone might give some guidance on this.

Ciaran

Answers (2)

2013-08-07

Arnav Joy answers:

can you tell me what you want to do ? for what you want to use API?


Ciaran Whelan comments:

Hi Arnav,

Thank you for responding, and great to see you online.
I am trying to make the services of Axcelerate

http://stg.axcelerate.com.au/apidocs/home/index

Display on a wordpress site. I do not really understand API and how to use an external API to display in a WP install.

2013-08-07

Sabby Sam answers:

Hello cmwwebfx,

It is really tough for anyone to tell you how to implement API without seeing the API on wordpress. But I would advise you to use the curl extenstion or json or something like below one
I hope this will help you

$url = 'https://xxx';

$body = array(
'auth_token' => 'xxxxxx',
'list_id' => 'xxxxx,
'name' => 'Office',
'campaign_id' => 'xxxxx',
);

$response = wp_remote_post($url, array(
'body'=>$body,
'sslverify' => false // this is needed if your server doesn't have the latest CA certificate lists
) );

if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
// error handling goes here
}

$results = wp_remote_retrieve_body( $response );
// $results has the actual results in it


Ciaran Whelan comments:

Hi there Sam,

The API is actually from an external source, and I want to display that source on the WordPress site. The details of the API are on their API page http://stg.axcelerate.com.au/apidocs/home/index, but I do not see how I can show the information into a WordPress site.


Sabby Sam comments:

Then use this plugin.

http://davidwalsh.name/wordpress-json-plugin


Sabby Sam comments:

I am sorry,
I just read the document. I gave you the link above read the one. It should implement in the same way as described the above plugin. The API returns json code. You need to manually transfer in human readable.
Try to search in Google " how to implement json data in wordpress site"
Hope this will help you.


Ciaran Whelan comments:

Hi Sam, that is why I am here to ask the question. I am really not use to using external API in WordPress, or how to display the external source on the WordPress site. The WordPress json Plugin seems to be made to use WordPress install as an API to display your WordPress in an external application.


Sabby Sam comments:

I am sorry.
Try this one http://php.net/manual/en/function.file-get-contents.php

As you said you need guidelines so we are giving guide how to implement. If you want to us implement then you need to increase the budget.