Backend as a Service Apinauten GmbH Hainstraße 4 04109 Leipzig 1
Backend as a Service Applications are equipped with a frontend and a backend. Programming and administrating these is challenging. As the application is being used day and night, the backend has to be available at all times. This is a cost-intensive task that requires lots of experience. Thanks to Backend as a Service these challenges are an issue of the past. Instead of spending time on the backend, you simply hand that task over to an experienced team. In the meantime, you can take care of the design and the improvement of your application. However, under no circumstances will you lose your individuality. You are able to integrate different ready-made modules into your backend, and by that determine the functionality yourself. Furthermore, you are able to develop your own functions independently and build them into your software. Advantages of Backend as a Service You are handing over a part of your software project to an experienced team. Why should you do that? What are the advantages? Saving time! Usually, you would have to worry about databases, user management, servers, and so on. These tasks require lots of planning. In the long run, this assignment can become very excessive and expensive. By the use of Backend as a Service, these time consuming processes will now be put to an end. Instead of worrying about these tasks, you are able to simply take recourse to an already developed backend. Another advantage is saving money. Running costs when using Backend as a Service are lower than individual hosting. Furthermore, the frontend developer, meaning the person developing the application, has complete access to the backend. Modules Every product has its own specific characteristics and needs individual modules and interfaces. In apiomat, these can be created without the requirement of additional software. Your application can also be enhanced by using ready-made modules. The following apiomat modules are available and will be easily configured in just a few steps: Module die an die API eines Dritten anknüpfen und damit deren Daten und Funktionen liefern: Mandrill Module Evalanche Module Facebook Module Tumblr Module Twitter Module Wordpress Module Paymill Module Google Analytics Module Piwik Module Module die den Funktionsumfang von apiomat erweitern: Push Module Chat Module Messaging Module Servercode Module Webhosting Module Restore Module CSV Module XML Module 2
That means your backend will be deployed and equipped with modules by just a few clicks. Of course you are able to develop and use your individual object-oriented data structure, which will be managed through the dashboard. Additionally, access rights and class attributes for every class can be set. Normally, it would take weeks to program a backend like this. Thanks to apiomat the backend is ready to go by just a few mouse clicks. That way you can focus on the actual issue: the app. Platform Independence To obtain a vast number of users, various platforms have to be approached. Owing to apiomat this process can be rendered easy. By just a few mouse clicks you are able to assemble your backend and then download an SDK that s tailored to your data model. This customized SDK provides all your model classes and the important methods required to communicate with the backend. You would like to develop an application on Android? No problem. There is an SDK for this! You would like to deploy the same application for ios? Simply download a corresponding SDK for that platform! apiomat offers SDKs for the most commonly used platforms: ios Java Android JavaScript PHP Titanium Python C# Testing, Testing, and More Testing Every application needs to be tested before going online. apiomat makes this step easier. Every project can either be deployed in Test, in Staging, or in Live. Consequently, it is possible to integrate a new function into the test system, and to sufficiently test it. When functioning without any errors, it can be integrated into the live system. Additionally, live data can be copied into the testing system. Thereby, use cases can be simulated. This system does not require any additional software, as everything can be operated from within your browser. Data Safety Naturally, data in your backend is being deployed through the frontends. That is how user data is being deposited. This data must be regarded as sensitive, and therefore has to be treated with caution. This is exactly the highlight of apiomat: The cloud containing apiomat is hosted exclusively in Germany. The data of you and your users are being protected by the best data privacy acts. You are the only one who is able to access this data. How it works The complete functionality seems to be extensive and difficult. Yet, the opposite is the case, as will be shown on a sample application, where apiomat s WordPress module will be applied. Within just a few steps, data of an already existing WordPress blog will be read, and additionally data will be sent to the blog. In plain language: The application is able to publish a post in the blog. 3
WordPress Module This module enables you to access functions of your blog. You are able to receive data from your blog, and send it to the same. In this way it is possible to get all published blog posts. You can create a new post as well. Should comments be permitted? You decide! By a few commands, the connection to the blog will be established and you can start working with the data. You will see how simple the handling is. Configuration of the WordPress Module Data is required to integrate the blog. The URL to the XML RPC interface, the user name, and the password of your blog are required. The URL to the XML RPC interface might look like this, for example: http://example.com/wordpress/xmlrpc.php. In older WordPress installations the XML RPC interface first had to be activated by checking a box. For further information on interfaces visit http://codex.wordpress. org/xml-rpc_support 4
Tutorial Let s go! If you didn t already do it, visit apiomat.com and log in with your account. Click LOG IN to get to the login form. If you don t already have one, you should create on by clicking SIGN UP. Backend 1. You are now in the dashboard. If you don t already have created an application, you will now be asked to do so. You can add a name and a description for this application. The name should be unique. In this example, the application will be called WordPressApiOmat. 2. On the main page of the dashboard you can see the module selection. As we want to work with the WordPress module, we will add the module to the application. To do this, simply click + which is located right next to the module. 3. The data of your WordPress blog will be processed in the dialogue that appears now. If you don t already have a WordPress blog, you should stop the tutorial at this point to sing up at Wordpress. com. Naturally, you can also host your blog yourself. To do this, you can use the documentation of WordPress for help. The URL has to refer to the XML RPC interface of your blog. This means your URL should look like this for example: http://example.com/wordpress/xmlrpc.php.enter the URL into the intended field. Also, enter your username and password into the corresponding fields. Click OK to confirm and to connect the module to the application. 5
4. By clicking the button Deploy your backend will be made available to requests and the SDKs will get generated. By opening the SDK tab (simply click on it) you will get to the SDK selection. As we aim to develop an application for the Android platform, we should download the respective SDK. After executing these 5 steps the creation of the application backend is completed. This is all that needs to be done to create an interface to your blog. What we need now is a frontend. It allows for the feature of data and for the interaction with the WordPress blog. Frontend 1. Open an IDE of your choice an create a new Android project. You should choose at least the Android SDK version 8. This means all devices with Android 2.2 (Froyo) or later are able to run your application. 2. Open the data manager and search for the SDK archive you downloaded. 3. Unpack the downloaded archive and copy both folders into the src folder of your project. All arrangements have been made, now we can start setting the layout. 6
Layout 1. By default, the Eclipse IDE makes a layout file (res/layout/activity_main.xml) with a relative layout. As we don t want to use this, we will create a linear layout with the attribute vertical, instead. That means each child element, for example a button or a text field, will be created one below the other. 2. Next, we ll add two EditText fields and a button to the linear layout. The first EditText element contains the title. The second one is a multi-line text box and will be used for the content. <LinearLayout xmlns:android= http://schemas.android.com/apk/res/android xmlns:tools= http://schemas.android.com/tools android:id= @+id/linearlayout1 android:layout_width= fill_parent android:layout_height= fill_parent android:orientation= vertical > <EditText android:id= @+id/posttitle android:layout_width= fill_parent android:layout_height= wrap_content android:hint= Titel /> <EditText android:id= @+id/posttext android:layout_width= fill_parent android:layout_height= 200dp android:gravity= top left 7
android:hint= Write your post here android:inputtype= textmultiline /> <Button android:id= @+id/send android:layout_width= fill_parent android:layout_height= wrap_content android:onclick= send android:text= send /> </LinearLayout> 3. After setting the layout the logic of the project can be added. To do this, we ll open our MainActivity. java and add an object of the type User to the oncreate method. We will also transfer username and password to this object. Afterwards, the new user will be saved. /* Create a new user of your app */ final User user = new User(); user.setusername( WordpressUser ); user.setpassword( wordpress ); Datastore.configure(user); /* and save it */ user.loadmeasync(new AOMEmptyCallback() { public void isdone(apiomatrequestexception exception) { if (exception!= null) { // if the member is not found on the server just create it user.saveasync(new AOMEmptyCallback() { public void isdone(apiomatrequestexception exception) { }}); } } }); 4. We ll now create a new object of the type post. The post needs a title, a content, and the blog ID. Attributes will be set via both the EditText fields. This means, they have to be found and retrieved by the layout ID beforehand. Next, we ll set the status of the post to publish. This way, the post will be published. Finally, the post will be saved in the backend of apiomat. //finding LayoutID EditText titel = (EditText) findviewbyid(r.id.beitragstitel); EditText text = (EditText) findviewbyid(r.id.beitragstext); // New Post 8
Post post = new Post(); // Set Title post.settitle(titel.gettext().tostring()); // Set Content post.setcontent(text.gettext().tostring()); // Set Status (Publish or Draft?) post.setstatus( publish ); // Save post, thereby publishing it post.saveasync(new AOMEmptyCallback() { public void isdone(apiomatrequestexception exception) { } }); 5. Next, we ll have to set permissions. This means that the Android Manifest has to be edited. As we ll access the internet, the respective Android permission must be added. <uses-permission android:name= android.permission.internet /> 6. Finally, we ll be able to start the project for the first time on the Smartphone. After filling in each field, click the button send to publish the post. 9