Parameters (GET)
There are a number of parameters available in the GET method to filter and search the Json API response.
Parameter | Default | Description |
---|---|---|
limit | 10 | The maximum number of items to return |
offset | 0 | The number of items to skip - often used for pagination. |
sync |
| sync=2019-09-02%2013:47:37 |
q | null | The q parameter can be set in the GET string to search for a specific term within all the job data. |
*field name |
| It is possible to search based on the value of specific fields. *Content Searching. |
fields |
| Reduce and Filter the Json response by adding field filters within your request. |
order | asc | desc option available (leave space). |
with |
| Ability to pull in relational data. This is a Form Example where we have the user Id and Vehicle Id but would like to pull in related user and vehicle record data: https://mysite.re-flow.co.uk/v1/api/DeclarationofVehicleResponsibility?fields=userId,vehicleId&with=user[name,email],vehicle[title] |
*Content Searching
It is possible to search for records using specific field values with more advanced logic. The ‘q' parameter will allow string search across all element data; however, there are specific searchable fields available such as ‘Title’ and ‘dateUpdated’ which are passable as parameters.
Additional flexibility is available through prefixing field values (such as title and dateUpdated) with a key specifying the search type. Field values without a defined prefix, will default to eq: and you must include : as part of the prefix.
Prefix | Description |
---|---|
eq: | Equals |
lt: | Less Than |
lte: | Less Than or Equal To |
gt: | Greater Than |
gte: | Greater Than or Equal To |
not: | Doesn’t Equal |
like: | Like |
notlike: | Not Like |
Example Requests
Return 10 records starting at the first record
/v1/api/projects/jobs?limit=10&offset=0
Return all projects but limit to 10 records starting at the first record but must contain the string ‘Reflow Test Job’ within any string field.
/v1/api/projects/jobs?limit=10&offset=0&q=Reflow%20Test%20Job
Return all projects but limit to 10 records starting at the first record but must contain the string ‘Reflow Test Job’ within any string field.
/v1/api/projects/jobs?title=Reflow%20Test%20Job
Return a single project which was last updated on or after 7am on 1st September 2020.
It is possible to combine 2 or more queries on 1 field by adding :AND:
or :OR:
in-between the values you wish to use. For example, searching between two dates for a field called ‘dateUpdated’ would be.
It is also possible to group multiple comparison values with the pipe character |
The example below is returning Records where the Customer field equals either Jack OR Jill.
This example includes the ‘not:’ (Doesn't Equal) prefix to exclude records where the customer field equals Jack OR Jill.
This example lists all jobs that do not have an event - the event section is ‘empty’.
Filtering Json Response
Using the ‘fields’ parameter will allow you to selectively return Json in the API response. This will help reduce the size of the payload and tailor it to meet your requirements.
Example | Comments |
---|---|
/v1/api/projects?fields=* | Return all fields |
/v1/api/projects?fields=*.* | Return all fields and all relations |
/v1/api/projects?fields=*.*.* | Return all fields and all relations 2 levels deep |
/v1/api/projects?fields=customer | Returns only the customer field and value. This can be expanded out to other field names. |
/v1/api/projects?fields=id,title,myRelationalField e.g. /v1/api/projects?fields=id,title,client | Return specified fields + all fields in relation
|
/v1/api/projects?fields=id,title,myRelationalField[id,title] e.g /v1/api/projects?fields=id,title,client[id,title] | Return specified fields + relational fields.
|
Example
Response
Item ‘id’ and ‘title’ returned along with relational element ‘client’ but only with fields ‘id’ and ‘title’.
Formatting Json Response
Prefix | Example | Comments |
---|---|---|
:ids | fields=id,title,myRelationalField:idsOnly | Only return an array of ids for this relational field. |
:first | fields=id,title,myRelationalField:first[id,title] | Only return the first relation as a nested object. |
:only | fields= id,title,myRelationalField:only.title | Only return the first field specified on the first relation. |
:merge | fields= id,title,myRelationalField:merge[id,title] | Merge in the fields specified on the first relation into the parent object |
Example
Response
Item ‘id’ and ‘title’ returned along with relational element ‘client’ but defined fields ‘id’ and ‘title’ are to be ‘merged’ into the parent object.
Change which relations are returned
Prefix | Example | Comments |
---|
Prefix | Example | Comments |
---|---|---|
:active | fields=id,title,client:active | Only return relations that are active in the system (default). |
:inactive | fields=id,title,client:inactive | Only return relations that are not active. |
:all | fields=id,title,client:all | Return all relations regardless of status. |
status | status=any or status=disabled or status=enabled |
|
:enabled |
| Internal use only |
:disabled |
| Internal use only |
:live (entry) |
| Internal use only |
:pending (entry) |
| Internal use only |
:expired (entry) |
| Internal use only |
:any | https://clientName.re-flow.co.uk/v1/api/projects?id=9309&fields=*,events:any | Events that have been disabled or Expired are not exposed in the API. They can be included but need to be asked for as seen here. |
Please note that text data is often first to arrive especially around form submissions. The ‘Assets’ such as signatures and images can often take longer to arrive so a flag has been provided and should be checked against to ensure all data is present before taking the payload and ticking it off your list.
It's not currently possible to change a form or user detail using the API.access user - only the author can change a form via the API. You can change the formStatus using the API but it will not be rendered within the Dashboard.