Using custom workflows, I’ve been able to create endpoints that can return custom fields.
For example my /beaches endpoint returns
{
“status”: “success”,
“response”: {
“name”: “Huntighton Park”,
“visits”: 1
}
}
My question is it possible to return an array of response objects like:
{
“status”: “success”,
“response”: [
{
“name”: “Huntighton Park”,
“visits”: 1
},
{
“name”: “Ocean beach”,
“visits”: 5
},
]
}
Note that I want to create an array of “custom” objects and not an array of native or database-defined objects for a particular field like
“name”:[“beach1, beach2”]
The /obj/ path can return array of objects, but those objects have to our database objects. There is no way to insert our own fields in the JSON that’s returned and specify how the value for those fields should be computed. For that reason, I am using custom workflows. I’ve created my own endpoints where I have more control over defining the key/values I want in JSON. However, I am not able to configure a response that has an array at the topmost level.