Rest API

Rest API allows you to perform actions such as queries and data update.

No data was found

Rest API allows you to perform actions such as queries and data update.

In order to connect via API you must receive the following parameters:

1.X-Parse-Application-Id – the database’s identifier. This parameter isn’t confidential.

2. X-Parse-Master-Key – the master password for your database. With its help, you have the highest permissions to the database. You must keep it unexposed to the users.

For the purpose of the exercise, we’ll create within the database a table named Accounts (in the case it doesn’t exist). In the table we will launch three fields –

1.Name – string

2.PhoneNumber – string

3.Score – Number

We will use an API simulator – https://apitester.com/

First example, turning to the Accounts table.

In the field ‘Request’ we’ll enter a general name for example.

We’ll choose ‘Post’ and enter the service address for Accounts –   https://apps.simbla.com/parse/classes/Accounts

In the field ‘Post Data’ we’ll enter the following value:

{

"_method":"get"

}

In the Header we’ll add three values:

1.Content-Type: application/json

2.X-Parse-Application-Id: Your application ID

3.X-Parse-Master-Key: Your Master Key

Now, once we examine the service (clicking Test), we’ll receive a list of clients’ objects existing within the database.

At this point, we’ll change the content of ‘Post’ and add a condition/filter Accounts by the name equals to John:

{

“_method”:”get”,

“where”:{“Name”:”John”}

}

Let test it again.

The following is a list of usable operations:

Key Operation

$lt Less Than

$lte Less Than Or Equal To

$gt Greater Than

$gte Greater Than Or Equal To

$ne Not Equal To

$in Contained In

$nin Not Contained in

$exists A value is set for the key

$select This matches a value for a key in the result of a different query

$dontSelect Requires that a key’s value not match a value for a key in the result of a different query

$all Contains all of the given values

$regex Requires that a key’s value match a regular expression

$text Performs a full text search on indexed fields

Additional examples:

Retrieve accounts where Email is : test@simbla.com.

{

"_method":"get",

"where":{"Email":"test@simbla.com"}

}

Retrieve accounts where name like Jo.

{

"_method":"get",

"where":{"Name":{"$regex":"^Jo"}}

}

Retrieve accounts where name is John and Phone Number is like 054.

{

"_method":"get",

"where":{"PhoneNumber":{"$regex":"^054"}, "Name":"John"}

}

retrieve scores between 1000 and 3000, including the endpoints, we could issue:

{"score":{"$gte":1000,"$lte":3000}}'

retrieve scores equal to an odd number below 10, we could issue:

{"score":{"$in":[1,3,5,7,9]}}

retrieve an account where the date & time is greater than or equal to 2019-04-13 – 14:15:

{

"_method":"get",

"where":{"createdAt":{"$gte":{"__type":"Date","iso":"2019-04-13T14:15:00.000Z"}}}

}

Post- Add a new record

In order to add a new record to the Accounts table, simply delete the "_method":"get" line:

Add a new record with the name "Jo" and email "jo@jo.com":

{

"Name":"jo",

"Email":"jo@jo.com"

}

Put- update an existing record

In order to update an existing record in the table, we will use the put method and add to the URL the id we want to update after the table name:

The data is the same, we will only send what we want to update:

{

"Name":"NotJo",

"Email":"NotJo@jo.com"

}

Read here the complete manual  of the Rest API: https://docs.parseplatform.org/rest/guide/

https://docs.parseplatform.org/rest/guide/
לא מצאת מה שחיפשת?
צור קשר עם התמיכה שלנו

מדריכים נוספים

grad1
Customer-Managed Relationship Concept - Businessman Arranging Small Wooden Blocks with Symbols on the Table.

פרופילים

במערכת מייביזנס ניתן להגדיר הרשאות לפי פרופילים / תפקידים.
grad1
Businessman Leading the global world business community of network communication connected. Digital and technological convergence with abstract blue background.

זאפייר

במדריך זה אנו נתמקד על ביצוע פעולות מיוחדות במערכת דרך הזאפייר ללא שימוש באפליקציה של mybusiness כגון הוספת רשומה (לד...
grad1
Checklist concept, Businessman checking mark on the check boxes with marker red

Queries

After reading the next guide, you will be able to use Simbla.Query to perform different actions on many objects at on...
grad1
Target customer, buyer persona, customer behavior concept. Marketing plan and strategies. Personalization marketing, customer centric strategies. Businessman touching on screen to target customer.

Objects CRUD

Data is stored and built around the Simbla.object that contains key-value pairs of JSON-compatible data.  This data ...