How can I remotely query if a user already exists?

How can I remotely query if a user already exists?

I already have the User Service plugin, but this requires that I try to create the user first and if he already exists then it throws the exception as a response. I’m trying to find a way to do this and the User Service plugin does not seem to have this feature.

I don’t want to have to create a user to see if it already exists, I would like to just ask the server if the users exists via a remote script just like User Server does it’s functions. Even if I need to install another plugin or if were easy enough to give me some php code or java code to replace in the User Service plugin, I would do it.

Thank you.

how to register new user with web ?

how to confing ?

please training

You could simple use the REST API plugin. If you try to get the user, the plugin response with user details or with status code 404 (not available).

Look here: REST API Plugin Readme

1 Like

I started using the REST API as RedEyes suggested. I also found this code online which works great.

<?php $secret = 'MyPass'; $url = "http://example.com:9090/plugins/restapi/v1/users?search=bruce"; $headers = array( 'http' => array( 'method' => "GET", 'header' => "Authorization: " . $secret . "\r\n" ) ); $context = stream_context_create($headers); $response = file_get_contents($url, false, $context); echo $response; ?>
1 Like