In this blog post I will describe how to build a Backbone.js web application, which connects to an SAP ABAP backend API over a RESTful JSON interface.
Requirements
Stateless API
The RESTful API provided by the SAP system must not store any state on the SAP server itself. This means there won’t be a session, and each request to one of the web services must include proper credentials.
Allow the user to login/logout
Even though the API is stateless, the user must be able to login to the web application by providing a username and password. And even though there won’t be a session, the user must also be able to logout from the web application.
Also, the web application should allow the user to remember the entered username on the login form, and the user should be logged out automatically after a certain period of inactivity.
Host the web application on any web server
The web application must be a JavaScript application which runs inside the client’s browser and communicates directly with the API provided by SAP. There must not be any server-side scripting (PHP, ASP, etc.), and no middleware must be required.