Select your language:
This document describes how to interact with MakeItApp BaaS REST API for CRUD operations with custom collections configured via Dashboard (see the BaaS introduction for details).
Ask your App Angel to create a new BaaS for you.
You will see in the Tools tab of your MakeItApp project the BaaS url and the private key.
Now you can access to your BaaS using the Dashboard and create a collection.
Collections can be managed using REST calls. All requests to the BaaS are under https and requires a key on the header. You will receive the key when the App goes in Development status.
Please note: all names are case sensitive!
You can use all MongoDB query syntax to filter data on our BaaS. Here details about filters on MongoDB.
Filter by field (get cards with color red)
Filter by regex (get cards with colors that start with r)
To retrieve a single element of the collection
To retrieve all elements of the collection
Example with CURL
Using curl - http://curl.haxx.se/download.html - you can manage your collection.
curl --header $SECRET -H Accept: application/json -H Content-Type: application/json -X GET $FILTER
Pagination uses “skip” and “limit” to identify pages. Skip identify the number of records to skip from the start. Limit the max result. If you have 300 results and you want to get the third page with a dimension of 50 records set skip to 100 and limit to 50.
Sort by card name. 1: ascending. -1: descending.
From Mongo website
$gt Matches values that are greater than the value specified in the query.
$gte Matches values that are equal to or greater than the value specified in the query.
$in Matches any of the values that exist in an array specified in the query.
$lt Matches values that are less than the value specified in the query.
$lte Matches values that are less than or equal to the value specified in the query.
$ne Matches all values that are not equal to the value specified in the query.
$nin Matches values that do not exist in an array specified to the query.
Get players with revenues greater that $100
Setup the user in BaaS table (you can create the User from the dashboard or using REST Post).
In the example. User: THE_USER. Password: THE_PWD.
curl -H "Accept: application/json" -X POST -d 'username='$USR -d 'password='$PWD $LOGIN
The result will be
You can use the id in the cookie
curl -H "Accept: application/json" --cookie "sid=$COOKIE" -X GET $ME
Obtaining the description of the user or the access to collections protected by a login (you can protect a collection).
The BaaS support also the upload/download and delete of files using the REST api :files.
To upload a file it’s necessary to send a multi-part request to the API. Here is the example with CURL
curl --header $SECRET -F file="myfile.txt" $URL/files/myfile.txt
Where $URL is the baseurl of your BaaS and $SECRET the secret key.
The API reply with a JSON that return the result and all information about the file. Locations contains the url that you can use to download the file.
You can get the complete list of files with a GET to files collection
curl --header $SECRET $URL/files
Put all together
curl --header $SECRET -H "Accept: application/json" -H "Content-Type: application/json" -d $FILTER_DATA -X POST $FILTER
curl --header $SECRET -H "Accept: application/json" -H "Content-Type: application/json" -X DELETE $FILTER