Hi,
I have following GET RESPONSE when I hit an api endpoint
{
“venue_name” : “elmirador”,
“created” : 1473833755000,
“___class” : “venue”,
“ownerId” : null,
“updated” : null,
“objectId” : “DCA37D93-7DEA-6E8C-FFD6-27E59B744D00”,
“__meta” : “{“relationRemovalIds”:{},“selectedProperties”:[“venue_name”,“created”,”___class",“ownerId”,“updated”,“objectId”],“relatedObjects”:{}}"
},
I’ve created an event describe in php after, but strugging to model an output let’s say only for ‘venue_name’
Kindly assist oh php implementation
Hi,
please specify what confuses you? I don’t clearly understand what’s the problem, sorry…
Stanislaw
Stanislaw,
I have a table, called ‘venue’. I have a columb called ‘venue_name’.
When i hit an API via get, the servers respond me with values such as created at, updated at, venue, etc.
I want to make server respond with my custom format such as in this case ‘venue_name’
I have created and event handler in php, event name ‘describe’ and now confused what shall I do in order to get desired output from the server
Kindly Assist
Well, there is a runner_context
argument in
public function afterDescribe( runner_context, entity_name, execution_result )
which is described here:
https://backendless.com/documentation/business-logic/php/bl_event_handlers.htm
You should change $prematureResult
:
Please try it and let me know if you got it work as expected.
Regards,
Stanislaw
Unfortunalte, could not manage. Could you please provide a code sample please
Sorry, I’m not a php developer and do not have any sample code for this case.
Writing the code for you is available, but payed option.
So what the problem with rewriting of $prematureResult
variable?
Stanislaw
Thank you Stanislaw. I appreciate
What are the charges for the code custmozization?
Marlen,
Response modifications from an API event handler is not possible. When you return an object, it goes through some additional layers which further validate it.
Regards,
Mark
Hi, Mark
Thank you for the response.
Any way I can modify the a response from GET method response so it won’t return me tables such as
created at
updated at
etc
?