By clicking on the button, the data is transmitted by an Ajax to the endpoint POST request. The data is in the form of a json array. Those. [{data: 1} {type: 1}, {data: 2} {type: 2}]
In endpoint, this is the code:
public function api_save_callback( WP_REST_Request $request ) { if ( !isset( $request )) { $response = new WP_REST_Response( 'Where is params', 400 ); return $response; } echo (var_dump($request)); $response = new WP_REST_Response( 'Ok', 200 ); return $response; } How to access elements in code?
PS Here is a sample POST data
[{"post-id":"1512709186613861455_196691920","post-url":"some_url","post-author":"testing","post-date":"Wed Sep 24 2064 17:47:09 GMT+1000","pic-url":"some_url","post-text":"Sea"},{"post-id":"1512696819280595861_196691920","post-url":"some_url","post-author":"testing","post-date":"Thu Feb 04 2112 17:52:34 GMT+1000","pic-url":"some_url","post-text":"#sea"}]