GF update affects REST API

The latest GF update broke my REST API script. The change (as far as i could work out) is something to do with the format / titles of the JSON response. I had to change how i refer to values within the response to get it working again.

Using this endpoint to pick a specific entry $_GET[‘gfid’] from a specific form 17:

https://newcastleproms.org.uk/wp-json/gf/v2/entries?form_ids[0]=17&include[0]=".$_GET['gfid']);

I had to change this:

$body = json_decode($output);

function objectToArray( $object ){
   if( !is_object( $object ) && !is_array( $object ) ){
    return $object;
 }
if( is_object( $object ) ){
    $object = get_object_vars( $object );
}
    return array_map( 'objectToArray', $object );
}

$array = objectToArray( $body );

foreach($array['entries'] as $item) {
 
    $date = $item['16']; 
  }

to this:

$body = json_decode($output);

function objectToArray( $object ){
   if( !is_object( $object ) && !is_array( $object ) ){
    return $object;
 }
if( is_object( $object ) ){
    $object = get_object_vars( $object );
}
    return array_map( 'objectToArray', $object );
}

$array = objectToArray( $body );

$mobile = $array[$_GET['gfid']]['13'];

Hello Adnaan. I recommend reporting this issue to Gravity Forms support:

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