This guide will help you integrating your own web service into your AppMachine app using our "Web service" building block.
The goal of this guide is to help you integrate your web service that will retrieve data. If you are looking for guides regarding creating, updating or deleting data via a web service please check out the related articles section.
Prerequisites
You will need the URL of the web service you want to integrate in your app.
How to
- Go to http://design.appmachine.com and open your app;
- Go to the "content" section of your app;
- Click Add block.
- Select the Pro tab.
- Select the Web service block and click Add block.
- Select Custom web service.
- In this step you will need the URL of your web service, so in our case this is going to be https://www.arminvanbuuren.com/feed/json/
Enter this url in the text field next to the Go button.
This guide does not include the use of parameters in your web service. Please check out the next guide to get to know more about this topic. - Click GO.
We will call your web service to get a result so when know what to expect, this can take a few seconds. - You see the result of your web service. It is important to know what kind of data we are dealing with. So in the Armin van Buuren sample we get the following result:
You see the result of the web service call we made when you clicked the "GO" button. We did make that call to detect the fields that are present in your web service result.
- What is the name of the field
- What type of data will be inside this field
So we already made a suggestion to the name and the type of data inside the field, but if you think we made a mistake, please adjust the name and the type by clicking in the left column.
If you need to know more about working with data types please take a look here.
- If you have your data in place, click Next.
- Give your web service a name. We already gave it a name for you but feel free to adjust it.
- Another important thing we need to know is whether or not the device should call your web service or if our servers should call your web service and distribute the result to the users of your app.
If you check the box, the devices call your web service. If your data will frequently change make sure to leave the checkbox checked.
Uncheck if you want to let our servers call your web service and distribute the result. After creating the block you can set the interval our servers will refresh your data. To alter the interval select you web service block and click on the three dots. - Click Next.
- Name your new block, so just pick a name and click "Finish";
Allright that's it, you have just integrated your first web service into your app!