Created
May 12, 2026 12:22
-
-
Save spivurno/c249d86314af31a83c5b5dd2394ac9ae to your computer and use it in GitHub Desktop.
Gravity Connect // API Alchemist // Return CarApi.com Years as Array
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| add_filter('gcapi_http_response', function($response_data) { | |
| $request = $response_data['context']['request']; | |
| if ($request && strpos($request->get_url(), 'https://carapi.app/api/years/v2') !== false) { | |
| $response_data['body'] = json_encode( array( | |
| 'years' => array_map( function( $year ) { | |
| return array( 'year' => $year ); | |
| }, json_decode( $response_data['body'] ) ), | |
| ) ); | |
| } | |
| return $response_data; | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment