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.

© 2008 - 2019. Gravity Forms is a project by Rocketgenius Inc.