954,604 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

PHP and REST API question

Hi all,

I have been asked to create an API for a website, which I would like to do, but havent done before.

Does anyone have a good tutorial on using procedural style php, integrated with REST to make an API work?

I have read that REST is really good and "easy" to learn.

So hopefully someone can point me in a direction on how I can solve/learn to integrate an API on this site :-)

Good day everyone,

Klemme

klemme
Posting Whiz in Training
265 posts since Mar 2011
Reputation Points: 18
Solved Threads: 7
 

http://www.gen-x-design.com/archives/create-a-rest-api-with-php/

http://stackoverflow.com/questions/4684075/how-to-build-a-restful-api (very basic example)

Depending on what you need to build, I can give you the code of a small test api I wrote (api.pritaeas.net).

pritaeas
Posting Expert
Moderator
5,484 posts since Jul 2006
Reputation Points: 653
Solved Threads: 875
 

Thanks, Ill have a look at your work.

It is for a webshop, thats wants to display products (The shop sells audio books, from a really big retailer), and the shop owner wants to list the items through this API, so potentiel customers can see them, and download them via the webshop.

And I was asked to set it up, which I gladly do, just have to learn it :-)

I obviously want to make it as basic as possible, an still make it work good and properly off course.

klemme
Posting Whiz in Training
265 posts since Mar 2011
Reputation Points: 18
Solved Threads: 7
 

So basic question for an API comes here:
1)
I have to connect to their server, right?
2)
They have an API/"interface" allready build, which I connect to/use to retreive data from?
3)
To show the data in the webshop, I can put them in a variable and echo it out or?

More question to follow.. ;-)

Klemme

klemme
Posting Whiz in Training
265 posts since Mar 2011
Reputation Points: 18
Solved Threads: 7
 

Okay, I may have missed something here. Are you requesting information on how to build an API (as per the OP), or information on how to use an existing one ?

pritaeas
Posting Expert
Moderator
5,484 posts since Jul 2006
Reputation Points: 653
Solved Threads: 875
 

I am trying to find out via the customer if one should be build or using an existing one..

Lets say the company he sells the audio books from, have an API - Then thats what I use isnt it? I connect to that and retrieve the data onto the webshop somehow?

Sorry if the questions are vague, as I havent made an API/nor used an existing one before

klemme
Posting Whiz in Training
265 posts since Mar 2011
Reputation Points: 18
Solved Threads: 7
 

Yes, if they have an API, you can use that.

pritaeas
Posting Expert
Moderator
5,484 posts since Jul 2006
Reputation Points: 653
Solved Threads: 875
 

Developers should not be so abstract and other PDO / prepared statement paralysis them to achieve a false sense of security layers. Unreliable data should always be verified and disinfection, DOP is another line of defense.

forkmartin
Newbie Poster
5 posts since Jan 2012
Reputation Points: 6
Solved Threads: 1
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: