How can I get users email (and additional data) from the rest API?

Question

How can I get the email adress from the users by using the REST API?
I’m authenticating with nonce, and it seems to be working since I can do POST requests and change stuff. Do I have to add something to make it return all the user info?

This is my JS:

(function($) {

    var nonce       = WPsettings.nonce;
    var rest_url    = WPsettings.rest_url;

    $.ajax( {
        url: rest_url + 'users/',
        dataType: "json",
        beforeSend: function ( xhr ) {
            xhr.setRequestHeader( 'X-WP-Nonce', nonce );
        }
    } )
   .done( function ( response ) {
        console.log( response );
    } );

})(jQuery);
0
Johan Dahl 2 years 2020-10-22T03:10:25-05:00 0 Answers 7 views 0

Leave an answer

Browse
Browse