Use this call to retrieve a list of things of a given type, optionally using search constraints.
Add parameters directly in the URL as a querystring (or in the body of the request). It can be limit, cursor, constraints, sort_field, and descending.
In most search requests, you will use field names. The logic behind the match between field names in the gyfti app and in the request is similar to the one that applies to types. The general rule to figure out the field_name for a given field is as follows:
– Remove the spaces of the caption.
– Use lowercase letters.
You can also use the name of the field that is returned in the objects. This is the way the field is represented in the app behind the scenes.
In the case where no field matches the field_name of the request, the server will return a 400 error. If two fields for the current type match the field_name, the first one will be used.
Pagination
By default, all GET requests return the first 100 items in the list. Our API supports the parameters cursor and limit for pagination. Use limit to specify the number of items you want in the response. The default and maximum allowed is 100. Use cursor to specify where to start.
At the end of each GET response, three values are returned that let you know where you are in the list:
– cursor: This is the rank of the first item in the list. It equals the cursor you sent, if any.
– count: This is the number of items in the current response. It is the minimum between the actual length of the list and the limit you sent or 100 if you did not specify a limit.
– remaining: This is the number of remaining items after the current response. Use this for the next call.
Search Constraints
Refine the list that is returned by the Data API with search constraints, exactly as you define a search in gyfti. To do so, pass a constraints parameter with the request. This parameter should be an array of constraints, e.g., objects with a key, constraint_type, and most of the time a value. If it is in the URL, it should be stringified and URL-encoded.
key: This is the field name the constraint applies to. You can also use the reserved key _all for a full-text search in the database.
constraint_type: This is the type of constraint you want to apply. It can be:
Constraint Type
Description
Field Types
equals or not equal
Use to test strict equality
All field types
is_empty or is_not_empty
Use to test whether a thing's given field is empty or not
All field types
text contains or not text contains
Use to test whether a text field contains a string, for text fields only.
Text fields only
greater than or less than
Use to compare a thing's field value relative to a string or number
Text, number, and date fields
in or not in
Use to test whether a thing's field is in a list or not
All field types
contains or not contains
Use to test whether a list field contains an entry or not
List fields only
empty or not empty
Use to test whether a list field is empty or not
List fields only
value: This is the value the constraint should compare to. It can be a string, number, list, etc., depending on the field type defined by the key in the current constraint. If the type of the value isn't correct, gyfti returns a 400 error, 'INVALID_DATA.'
Constraints with an undefined value are ignored. Do not use '_id' as a key for a constraint. Instead, use the call that retrieves a thing by ID. See above.
Example
For example, if you're looking for all 'campaign' whose 'Campaign Type' is 'Trigger' and 'Owner' is '1617009449761x480450913718632450' you will send a constraint parameter as follows:
Key
key
Campaign Type, Owner
constraint_type
equals, equals
value
Trigger, 1617009449761x480450913718632450
The url should look like this : https://app.gyfti.fr/api/1.1/obj/campaign?constraints=[{"key":"Campaign Type","constraint_type":"equals","value":"Trigger"},{"key":"Owner","constraint_type":"equals","value":"1617009449761x480450913718632450"}]
Or URL-Encoded:https://app.gyfti.fr/api/1.1/obj/subanswers?constraints=%5B%7B%22key%22%3A%22type%22%2C%22constraint_type%22%3A%22
equals%22%2C%22value%22%3A%22Trigger%22%7D%2C%7B%22key%22%3A%22Owner
%22%2C%22constraint_type%22%3A%22equals%22%2C%22value%22%3A%221617009449761x480450913718632450%22%7D%5D