Customising JSON response

Hi,

I have setup the REST API in Gravity Forms to accept form submissions. This working as expected, and I am getting the usual 200 success status, with the returned JSON response.

How do I edit that JSON response message?

Sorry if this is a bit of a newbie question :blush:

Thanks,
Andy

Hi Andy, can you explain how or why you want to change the response? Is there something happening after that, where you need to see a different message?

Hi Chris,

The current JSON response looks like this:

{
ā€œis_validā€: true,
ā€œpage_numberā€: 0,
ā€œsource_page_numberā€: 1,
ā€œconfirmation_messageā€: ā€œ55ā€,
ā€œconfirmation_typeā€: ā€œmessageā€
}

I’d like to add some additional items to the body such as:

ā€œdate_createdā€
ā€œstatusā€

I’m not sure what other fields may be available, but the above would be the basics I’d be looking to add.

Eventually I will be creating workflow (via Gravity Flow), which may change the workflow stage that can then be updated via a response message, but I haven’t gotten that far yet.

Thanks,
Andy

The date_created and status are not returned in the response when submitting a form. If the user performing the request has permissions to read entries, you can grab the entry ID from the response and then perform another call to grab the entry, and the specific information you need about the entry (like date_created and status.)

Thank you.

Hi Andy,

When you do get to that eventually state, make sure you take a look at the Incoming Webhook extension documentation. It can cover both being used as a step within an exiting workflow or as the trigger to receive the initial entry creation. In both cases, the field mapping / response customization option sounds like it would be a very good fit for your use case.

Cheers,
Jamie