Click here to Skip to main content
15,886,017 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Is there any documentation for it?
I've found lots of tutorials for "GET", but I can't find anything for "POST"

What I have tried:

For example to get data from database I use these codes:
PHP
add_action( 'rest_api_init', 'myfunction_name' );
function myfunction_name() {
register_rest_field( 
    'endpoint_name', 
    'field_name',
    array(
        'get_callback'    => 'get_data',
        'update_callback' => null,
        'schema'          => null,
         )
    );
}

function get_data() {
  $my_array = get_post_meta(
    15,
	"db_column",
	false
  );
return $my_array;
}


Now I want to create an endpoint and POST data to database with that.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900