Make RESTful Calls
This Tutorial illustrate how to make REST calls using EachScape Remote Query Block
To use Parameter in a Live Feed review the Tutorial Using Parameter in a Live Feed
First we will describe the Block then illustrate its usage
In this Tutorial we show to build a simple username / password verification: The app calls a server which validate the user credential.
Examples of Remote Query Blocks are available through Tutorial Apps Write into a Cloud Collection Update Cloud Collection Save Photos into a Cloud Collection
Remote Query Block
Remote Query Block uses base URL which is the address of your endpoint.
It supports the following Parameters:
- Add as many text fields as needed
- One image
- and/or one video per RESTful call
Choose the HTTP method (POST, GET, PUT, DELETE) used for the request, and store fields from the response in one or more variables that you have defined.
The Block will trigger a different Event (Success, Failure, No Response) depending on the response from the remote server.
The request (query) will be sent by the Remote Query Block as soon as the Block is visible on the screen.
The Remote Query will automatically appends the parameters.
You do not need to add the '?' and other '&' in the string.
The Remote Query response handler will NOT PARSE data sources.
To use parameters in a data source call, you need to enter these parameters as query parameters in the data source construct, please review the Tutorial:
It's convenient to put the Block as the only block on its own layer. The layer containing the remote query block is added using the Add Layer Action when the event occurs that you want to trigger the remote query. The layer is removed when the request is completed using the Remove A Layer action on the Success/Failure/No Response events.
You can add up to 24 Text parameters Fields to your call.
You will need to define:
- The Name of the Parameter
- The Value of the Parameter
You can pass one image per call.
You MUST store the Image in a Custom Image Block.
Select that Image Block in the pull down menu for 'Image Block'.
The Image Name is the equivalent of the 'Name' for our Text Parameter, it's the name of the parameter i.e. the Key.
Image Filename is the name of the image file on the receiving server. It's important meta data.
The End point doesn't have reference to the Image Block used in the app, the Image Filename will help link the two together.
You can pass one video per call.
Enter the URL of the video passed at a parameter
You can define up to 24 Response Variable per REST call.
These EachScape variable will store the response from the Web Service.
The application will be able to use these variables internally.
We will shortly provide an example of WordPress Authentication to illustrate Response Variables.
If you need it sooner, please email us
The Remote Query Block has 3, mutually exclusive, outcome Events
- No Response
As usual, associate any EachScape Action to these Event to address the different possible outcome.
These are shown in the different app Tutorials:
- Parametrized Datasource Calls