Forum Academy Marketplace Showcase Pricing Features

Sending custom fields in obj endpoint response

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”]

I am not quite sure what you mean by “custom fields” here.

The GET on an /obj/ returns an array.

{
“response”: {
“results”: [
{
“Created By”: “1457720302114x715773327974602600”,
“Created Date”: 1457720336789,
“Modified Date”: 1459032619842,
“text_text”: “1111”,
“image_list_image”: [
//s3.amazonaws.com/appforest_uf/f1458600223402x398214986547827700/RRFC_logo_large.png”,
//s3.amazonaws.com/appforest_uf/f1458600588237x285999526735395200/thefacebookface.jpg”,
“”
],
“file_list_file”: [
//s3.amazonaws.com/appforest_uf/f1459032616329x486390345497056830/watershed.jpg”,
//s3.amazonaws.com/appforest_uf/f1459032617035x865128962323069600/Screenshot_2015_10_04_14.50.09.png
],
“_id”: “1457720342200x615233279379112000”
},
{
“Created By”: “1457720302114x715773327974602600”,
“Created Date”: 1457720339553,
“Modified Date”: 1459033002155,
“text_text”: “2222”,
“image_list_image”: [
//s3.amazonaws.com/appforest_uf/f1458023254345x697754588909447200/ponte_com_por_do_sol.jpg”,
//s3.amazonaws.com/appforest_uf/f1458023383464x851094187702983700/280px_Box_Hill_Salomons_Memorial.jpg”,
//s3.amazonaws.com/appforest_uf/f1459032978616x473041318589821440/prebeermile.jpg
],
“file_list_file”: [
//s3.amazonaws.com/appforest_uf/f1459033000597x934221363393589900/bugle.png”,
//s3.amazonaws.com/appforest_uf/f1459033000921x684254198800772500/transitiontentmock.jpg
],
“_id”: “1457720344975x218859319888707600”
},
{
“Created By”: “1457720302114x715773327974602600”,
“Created Date”: 1457720354591,
“Modified Date”: 1457720354592,
“text_text”: “3333”,
“_id”: “1457720359919x250958588508897300”
},
{
“Created By”: “1434804802215x891076338011771400”,
“Created Date”: 1458023202694,
“Modified Date”: 1459033428370,
“text_text”: “yhimng”,
“file_list_file”: [
//s3.amazonaws.com/appforest_uf/f1459033424946x419268021592870340/transitiontentmock.jpg”,
//s3.amazonaws.com/appforest_uf/f1459033424998x687879294157028200/Screenshot_2015_10_04_14.50.09.png”,
//s3.amazonaws.com/appforest_uf/f1459033426922x794508828315883900/watershed.jpg
],
“_id”: “1458023202694x777808154467493200”
}
],
“cursor”: 0,
“count”: 4,
“remaining”: 0
}
}

But does have all the bubble related fields in it. Not sure you can remove them from being sent from bubble ?

Is that what you mean ?

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.

Ah, I see.

So instead of an GET on an /obj/ endpoint you are doing a … POST on a /wf/ ? And trying to configure the response ?

Is that right ?