Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Connecting to an API 19 Aug 2013 15:25 #10824

  • Storm
  • Storm's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 4
  • Thank you received: 0
Hi,

How can I integrate a connection to an API and then use the component builder to extract information from the API?

Thanks

Please Log in or Create an account to join the conversation.

Connecting to an API 19 Aug 2013 15:39 #10825

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
Hi and welcome to the community.

It depends what do you want to do.
Often, the use of JDom is a great choice becaue it automatically include all the requirements (assets : js/css/images/) in the right place.

For instance you can see how the google map is integrated in the tutorial.
www.j-cook.pro/index.php/m/many-to-many
Chapter 7 and 8

Hope it helps.
Coding is now a piece of cake

Please Log in or Create an account to join the conversation.

Connecting to an API 19 Aug 2013 15:40 #10826

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
Sorry, I think you mean an another type of API...
You want to get datas from this API and furnish them to your PHP source.

I need to know more about your request.
Coding is now a piece of cake

Please Log in or Create an account to join the conversation.

Connecting to an API 20 Aug 2013 06:43 #10860

  • Storm
  • Storm's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 4
  • Thank you received: 0
Hi,

Yes I want to be able to connect to an API here:

apisandbox.inapub.co.uk

Basically, I want to build a Component which allows Admin users to be able to enter an ID (or set of ID's) in the new Component, which takes that ID from the connected API and displays them on the front-end of Joomla.

In principal it should be quite straight forward, but I can't work out how to get your Component builder to connect to an external API.

Please Log in or Create an account to join the conversation.

Connecting to an API 20 Aug 2013 07:43 #10861

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
I do not know too.

Use fsocketopen() when you need to extract html or decode JSON.
Use simple iframes if you need only HTML.

What to say more ?
To build your URL, concat the values you need coming from Cook.

I cannot really help you more because I never used this API. But I am sure it is not a big deal.

fsocketopen() some code around. Try to find an example in order to simplify those calls.
Coding is now a piece of cake

Please Log in or Create an account to join the conversation.

Connecting to an API 20 Aug 2013 07:45 #10862

  • Storm
  • Storm's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 4
  • Thank you received: 0
Thanks for your reply, I know the API uses REST to connect, does that help at all?

Please Log in or Create an account to join the conversation.

Connecting to an API 20 Aug 2013 08:32 #10863

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
Yes, it is was I saw.

Well, it is exactly the same than AJAX if you want.
AJAX can return formated HTML, or JSON object. (or else, but to undestand)

It depends your requirements and how you will integrate it. But of course Cook can do that, because it does already for ajax.
The only difference is instead of calling a local uri, you call a non local.
Coding is now a piece of cake

Please Log in or Create an account to join the conversation.

Connecting to an API 20 Aug 2013 08:45 #10864

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
Also :

If you need the returned datas interpretable by PHP, you need a socket.

If you want html integrated without frame, you need a socket too.

If you want only simple formated HTML (iframe)

If you need to decode JSON in javascript, use Ajax query

Hope it helps. I cannot do the job for you.
I am curious about the following of your adventure.
Coding is now a piece of cake

Please Log in or Create an account to join the conversation.

Last edit: by admin.

Connecting to an API 23 Aug 2013 07:07 #10891

  • Storm
  • Storm's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 4
  • Thank you received: 0
HI,

Thank you for your replies so far, I do have one more question, where can I put the connection information in the Builder? I want to purchase your builder but I want to make sure it can connect to the API first and I don't know where to do it. Pleas help.

Thank you

Please Log in or Create an account to join the conversation.

Connecting to an API 23 Aug 2013 14:54 #10897

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
Oh no, there are no ready-to-go feature for that.

You have to code inside your component.
It is not a big deal, but I cannot explain you in details all the way how to do it.
If is it your first component, first understand how the views are calling the datas.
and how the models are loading and filtering the datas...
etc...

Then, it depends the way you choose to call the API (Ajax and JSON result, fsoketopen, iframe...)
I cannot help you more.
Coding is now a piece of cake
The following user(s) said Thank You: kreeer

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.081 seconds

  Excellent Tool ! This tool will save you a lot of time writing the same old structure. I've used others but this is really nice for a quick start. Makes a 3 hour task a 15 minute one. Thanks for this extension
dickrundell (JED)
         

Get Started