Monthly Archives: April 2013

REST and oAuth for Magento Developers

REST functionality has been a part of Magento since version 1.7. Older versions of Magento supported only SOAP and XML-RPC implementations. While you can still take advantage of SOAP and XML-RPC functionality in newer versions of Magento, it is well worth learning how to use REST services in Magento.

Using oAuth and the Magento API

To consume REST services in Magento, you must use oAuth for authentication. To do this,y ou must create an oAuth consumer, and obtain an oAuth token for the service which you would like to consume. Tokens can be found under the System > Web Services section of the Magento admin panel. Using oAuth offers an added degree of security because the user does not need to provide their direct Magento login details to a third party App, and can revoke an app’s rights to access the services at any time.
There are three REST consumers which can access resources under the Magento API, these are:
• Guest – a front-end user who is not logged in
• Customer – a front-end user that is logged in
• Administrator – a user that is logged in to the back end.
Each REST consumer has different roles, and has different capabilities. For example, a customer may be able to create, retrieve, update and delete their own address and manage their orders, while a non-logged in frontend user or programmer would only be able to retrieve product listings and view certain parts of the site.
The REST implementation allows two possible actions on each resource – writing and reading. A guest may only read, a customer has read access to most resources and may have limited write capabilities. Administrators can read and write to any resource.
REST Apps are listed in the REST My Apps section of the admin panel. Users also have a My Apps section on their account page, which allows them to manage oAuth apps that they have authorised to access their accounts.

Is the LAMP Stack Obsolete?

For many years, the LAMP stack was the king of the world of web development. If you wanted to build a successful, stable and high performance website you would use Linux, Apache, a database (usually MySQL) and PHP/Perl.
Today, that has started to change. An increasing number of websites are being built based on other frameworks such as Ruby on Rails, and one app may use multiple languages – such as PHP, Python, Ruby and JavaScript. Instead of building a “stack” we sit languages next to each other, relying on distributed computing an cloud servers to build a scalable website.

The Tools Are Not Obsolete

The tools themselves are not obsolete. Linux is still the operating system of choice, and Apache is still one of the better servers (although Lighttpd and nginx are becoming increasingly popular). PHP is still a good language, and MySQL, while losing some ground to PostgreSQL, is still a good database choice.
The issue is not with the tools, simply the way we use them. The days of monolithic architectures are ending. Web Developers are working with increasingly complex setups in the cloud, and this requires a new way of thinking.

The Linked Framework

Thanks to Amazon Web Services and other cloud solutions, developers can now install any applications and frameworks they need on a cloud server with just a few mouse clicks. These cloud services are elastic – when you need them, they’re available and will expand to offer as much computing power as necessary. When you don’t need them, the processes are stopped and you are no longer billed – you only pay for what you use.
This system is a boon for developers. It’s fast, inexpensive, and flexible. It may be that the LAMP stack is becoming obsolete not because of a lack of power, but because of a lack of flexibility – why pay for power if you aren’t using it?