Write into Cloud Collection from an App
Introduction
In this tutorial we show how to use the Remote Query to write into a Cloud Collection from an app.
You MUST authorize your app to write into your Cloud Collection. See how.
Tip: If you are familiar with Web Services, know that Cloud Collection are accessible through the Cloud Collection API.
Note:
Cloud Collection is accessible through a RESTful web service. Meaning this Tutorial can be extended to the use of any web service. The Remote Query uses RESTful, that means you can store content in a any CMS, not solely EachScape Cloud Collection.
Install the Demo
Install the Tutorial App "WRITE IN CLOUD COLLECTION"
(Free free to edit both the app and collection, these are yours)
The App
This Tutorial app allows a user to enter text then store that text into a Cloud Collection.
It uses
- Text Input Block
- A simple Text Block used as a 'Submit' button
- A list block to load Cloud Collection Data.
- Most importantly: The Remote Query Block to write into the Collection.
Writing into the Collection
The app asks for a name (text) that will be stored in the collection

Implementation: The app stores the result of the Text Input Block into a variable name: 'Var_Name'

Remote Query
When you push the 'Submit' button, the app adds the Layer 'Remote Query Layer' which runs the Remote Query Block.
The Remote Query Block takes the 'Var_Name' variable and constructs a call (REST) to write into the collection (It uses Cloud Collection API)
Remote Query write into the Collection using the RESTful protocol
Settings for the Remote Query
2 critical things ought to happen.
FIRST: You need to create a key to be able to write into that Cloud Collection.
SECOND: You need to use that key (api_key) as a parameter in the Query Block . This lets the app authenticate itself with that collection.
1. Create a key
The key creation is very easy. Follow the Tutorial Authorize Write Access into A cloud Collection
2. Use the key: api_key

Settings:
- URL The call to the cloud collection.
- The default value in the URL field is the URL used for any Cloud Collection.
- If you are using a different service than the EachScape Cloud Collection then remove that URL and enter the one pointing to your web services.
- Fields #1you have to configure that field with the API KEY:
- Name: You have to enter 'api_key' in the Name field.
- Tech Note: This is the name of the parameter you are passing to the end point.
- Value: The unique api_key you generated from your cloud collection. Copy paste the value in that field. It uniquely identify your app and authorize your app to write in that collection.
- Name: You have to enter 'api_key' in the Name field.
- Fields #2The text value to update in the Collection
- Name: Enter the EXACT name of the column of the cloud collection using the following format:
- values[EXACT name of the column]
- For example, for a column named 'Name' the syntax would be
- values[Name]
- (see screenshot above for example)
- Value: The value to be saved to the column specified in Name. In our case that value in the variable from the Text input block.
- [[var: VAR_Name]]
- That variable comes from the Editor you can pick it from the 'Variable' section.
- Name: Enter the EXACT name of the column of the cloud collection using the following format:
- Fields #N... In this Tutorial we only use one field to save one variable.
- You can use up to 28 fiels in a Remote Query
- The set up is the same as above for each new field.
TIP
When your column name have more than one word, for example "My Column Name"
enters the name in Remote Query Block exactly as you see it in your collection:
Additional Settings for Remote Query
- "Status Code Key"
- "Status Reason Key"
These will be set as Variable values of the status of the server when the app communicates with it.
We set the Response Type as "XML"
and the Response Parser as "XPath".

Success, Failure, No Response
These are visible under the Event tab of the Remote Query.
The 3 events are:
- Success
- Failure
- No Response.
Success
That Event is triggered when the call to Cloud Collection is successful.
When the app receives a "Success" event it switches to the View called "Success View".
It also removes the Layer that contains the Remote Query.
Failure
That Event is triggered when the call to Cloud Collection returns a failure.
When the app receives a "Failure" event it shows a pop-up alert to let the user know the upload was a failure.
It also remove the Layer that contains the Remote Query.
No Response
That Event is triggered when the call to Cloud Collection times out. No response is received.
When the app receives a "No response" event it shows a pop-up alert to let the user know that it can't communicate with the server.
It also removes the Layer that contains the Remote Query.


At that point, if you go to the Cloud Collection (or reload the page if you were already on) you will see the name 'John Doe' previously entered stored in the Collection:

Similarly if you select the 'See List from Cloud Collection' in the app
the app will display the newly updated Cloud Collection

Reminder
How to generate that api_key is described in the Tutorial: Authorize Write access to a Cloud Collection
Reminder of the settings of the Remote Query in Studio

- Add, Delete, Update a row from a Cloud Collection
- Use RESTful with EachScape: Introduction to Remote Query Services