1

I tried to test out WordPress REST API by deleting a user (using basic authentication just to see if everything works), but no matter how I try to pass the parameters to the destination server, I always get rest_missing_callback_param.

Here is a screenshot from POSTMAN:

Authentication is correct. Parameters set.

It happens even when I tried with PHP:

$ch = curl_init(); curl_setopt( $ch, CURLOPT_URL,"http://web.com/wp-json/wp/v2/users/3" ); curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, "DELETE" ); curl_setopt( $ch, CURLOPT_HTTPHEADER, array( 'Authorization: Bearer ' .$authToken ) ); curl_setopt( $ch, CURLOPT_POSTFIELDS, $http_query ); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); $output = curl_exec( $ch ); curl_close( $ch ); 

What could possibly be a problem here?

Thank you.

    1 Answer 1

    3

    You need to deliver another argument - the reassign.

    "Reassign the deleted user's posts and links to this user ID." - WP API documentation

    Please try like this:

    DELETE http://web.com/wp-json/wp/v2/users/3?reassign=NEW_USER_ID 
    1
    • You might also need to pass force=true, so the url would look like this: http://web.com/wp-json/wp/v2/users/<id>?reassign=<id>&force=trueCommentedAug 6, 2019 at 15:39

    Start asking to get answers

    Find the answer to your question by asking.

    Ask question

    Explore related questions

    See similar questions with these tags.