nderjung
nderjung

Reputation: 1617

Creating a REST API Client & Server

I'm interested in creating an application that will provide an API service. Similar to Facebook, end-developers would be able to register an application and receive personalised data in order to access the provided API via a third-party application. I want to provide, at the moment, a PHP and JavaScript SDK that will allow developers to access the API via a secure method (private-public keys).

I think I have, more or less, grasped the overall understanding of how to approach this:

Additionally, I hope to utilise the API internally, i.e. make PUT/GET/POST/etc requests via an internal JavaScript file on the site itself.

I am hoping to use CodeIgniter as a base to start the application, so if any suggestions to libraries, techniques and methods to approach this would be fantastic.

Specifically, any reference to:

would be extremely helpful. I can't seem to find anything.

I am aware of the following:

https://github.com/philsturgeon/codeigniter-restserver

Which acts as a good template for developing APIs, however, is not database-authenticated.

Any help is greatly appreciated!

Upvotes: 4

Views: 2173

Answers (3)

Johnathan Kanarek
Johnathan Kanarek

Reputation: 854

Having two levels of API is usually not needed, for architecture and security reasons you can separate your code to facade and core logic. As for client side, I recommend on auto-generation of the client based on some auto-generate API descriptor, that will enable you to update the client library with a click. In Kaltura we generate XML descriptors for ALL API servers that generated using reflection from the server code, see example: http://www.kaltura.com/api_v3/api_schema.php From that descriptor we auto-generate many different client libraries in different coding languages, see generator: https://github.com/kaltura/clients-generator, you can use it as is.

For more REST API server guidelines, see my blog: http://restafar.com/create-new-rest-server/

Upvotes: 0

Dmitry Shilyaev
Dmitry Shilyaev

Reputation: 733

The best way is to create regular WEB-app with your framework - it's like admin panel with maximum flexibility without need to implement any additional REST calls. And then create REST API to your app as a module (or plugin) with only necessary API calls. If you going to use your REST API for client and internal purposes, one day you find yourself locked inside your own API.

Upvotes: 0

david
david

Reputation: 33607

Drupal8 is being built on top of Symfony2 to help with RESTful components of the framework.

So I would look at that framework for sure.

REST APIs with Symfony2: The Right Way

Upvotes: 0

Related Questions