3

We're planning a new project which will feature an API available to customers to interact with our app from their own web sites and systems. However never having built anything close to an full-fledged API in the past, I am not aware of any standards or recommendations that are available and could be used to make the API more easily adapted by our customers.

We will build the API using PHP and some parts of the API will need authentication while others don't. As of today, I have read a little about Oauth, SOAP & REST, but I have no idea on what is good practiec.

What technology/standard is recommended to base an API for 2011+ upon?

Industrial
  • 41,400
  • 69
  • 194
  • 289
  • 1
    Personally I vote for rest api with oauth v2. – zerkms Mar 08 '11 at 14:15
  • Tough question: I've seen services imply using http-basic-auth and others require a API token in the URL. Oauth seems quite heavy to me. SOAP & REST are not about authentication, but about the way you expose your data to the user and how they query it. – Wukerplank Mar 08 '11 at 14:19
  • 2
    While you might be choosing between SOAP and REST for your service, you should also take a look at the technical differences between each and see which one suits your needs: http://stackoverflow.com/questions/28950/guide-to-choosing-between-rest-vs-soap-services. But unless there's any feature of SOAP that you really need, I think REST should probably be your first choice. – wkl Mar 08 '11 at 14:19

2 Answers2

4

There are a number of options, but I would suggest that you may find publishing a SOAP API from PHP quite tricky to maintain.

The reason for this is that there is no inherent WSDL generation within PHP, so you'll either have to roll your own (and modify it each time), or experiment with one of the 3rd party tools - none of which I have found particularly satisfactory in the past.

I would suggest that a more straightfoward method for implementing an API in PHP would be to go down the RESTful route.

rvxnet
  • 457
  • 5
  • 16
1

I would check out the choices made by successful APIs that are available through sites like Mashery or Programmable Web. By focusing on the successful API patterns before choosing a technology you will have a better chance that the API will work and be successful.

amelvin
  • 8,919
  • 4
  • 38
  • 59