Auth Server API
getUserInfo
Learn how to use the getUserInfo JSON-RPC method.
POST
/
#getUserInfo
getUserInfo
curl --request POST \
--url 'https://api.particle.network/server/rpc/#getUserInfo' \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"id": 1,
"method": "getUserInfo",
"params": [
"UUID",
"Token"
]
}
'import requests
url = "https://api.particle.network/server/rpc/#getUserInfo"
payload = {
"jsonrpc": "2.0",
"id": 1,
"method": "getUserInfo",
"params": ["UUID", "Token"]
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({jsonrpc: '2.0', id: 1, method: 'getUserInfo', params: ['UUID', 'Token']})
};
fetch('https://api.particle.network/server/rpc/#getUserInfo', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.particle.network/server/rpc/#getUserInfo",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'jsonrpc' => '2.0',
'id' => 1,
'method' => 'getUserInfo',
'params' => [
'UUID',
'Token'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.particle.network/server/rpc/#getUserInfo"
payload := strings.NewReader("{\n \"jsonrpc\": \"2.0\",\n \"id\": 1,\n \"method\": \"getUserInfo\",\n \"params\": [\n \"UUID\",\n \"Token\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.particle.network/server/rpc/#getUserInfo")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"jsonrpc\": \"2.0\",\n \"id\": 1,\n \"method\": \"getUserInfo\",\n \"params\": [\n \"UUID\",\n \"Token\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.particle.network/server/rpc/#getUserInfo")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"jsonrpc\": \"2.0\",\n \"id\": 1,\n \"method\": \"getUserInfo\",\n \"params\": [\n \"UUID\",\n \"Token\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"jsonrpc": "2.0",
"id": 1,
"result": {
"uuid": "2d7b1ff2-0791-4fd2-a26e-16fbcaefdf8a",
"phone": null,
"email": "U1gphy1mnU@particle.network",
"name": null,
"avatar": null,
"facebookId": null,
"facebookEmail": null,
"googleId": null,
"googleEmail": null,
"appleId": null,
"appleEmail": null,
"twitterId": null,
"twitterEmail": null,
"telegramId": null,
"telegramPhone": null,
"discordId": null,
"discordEmail": null,
"githubId": null,
"githubEmail": null,
"twitchId": null,
"twitchEmail": null,
"microsoftId": null,
"microsoftEmail": null,
"linkedinId": null,
"linkedinEmail": null,
"createdAt": "2022-06-08T07:47:54.000Z",
"updatedAt": "2022-06-08T07:47:55.000Z",
"wallets": [
{
"chain": "evm_chain",
"publicAddress": "0x6D5fCEd0C74F22a1B145ef48B25527Ce9BF829bF"
}
]
}
}Understanding getUserInfo
-
getUserInforetrieves a JSON object containing various data points relating to a registered user (a user that has already undergone social login), such as their name, UUID, token, email, and so on. The population of specific data points (such asfacebookId,googleId, etc.) will be dependent upon their primary associated social account.` It takes:-
UUID- string. -
Token- string.
-
Query example
JavaScript
const axios = require("axios");
(async () => {
const response = await axios.post(
"https://api.particle.network/server/rpc",
{
jsonrpc: "2.0",
id: 0,
method: "getUserInfo",
params: ["Particle Auth User Uuid", "Particle Auth User Token"],
},
{
auth: {
username: "Your Project Id",
password: "Your Project Server Key",
},
}
);
console.log(response.data);
})();
Authorizations
Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.
Body
application/json
Request parameters for retrieving user information.
Version of the JSON-RPC protocol, should be 2.0.
Example:
"2.0"
The request identifier.
Example:
1
API method being called, should be getUserInfo.
Example:
"getUserInfo"
Parameters for the API method call, including the user's UUID and session token.
Example:
["UUID", "Token"]
Was this page helpful?
⌘I
getUserInfo
curl --request POST \
--url 'https://api.particle.network/server/rpc/#getUserInfo' \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"id": 1,
"method": "getUserInfo",
"params": [
"UUID",
"Token"
]
}
'import requests
url = "https://api.particle.network/server/rpc/#getUserInfo"
payload = {
"jsonrpc": "2.0",
"id": 1,
"method": "getUserInfo",
"params": ["UUID", "Token"]
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({jsonrpc: '2.0', id: 1, method: 'getUserInfo', params: ['UUID', 'Token']})
};
fetch('https://api.particle.network/server/rpc/#getUserInfo', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.particle.network/server/rpc/#getUserInfo",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'jsonrpc' => '2.0',
'id' => 1,
'method' => 'getUserInfo',
'params' => [
'UUID',
'Token'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.particle.network/server/rpc/#getUserInfo"
payload := strings.NewReader("{\n \"jsonrpc\": \"2.0\",\n \"id\": 1,\n \"method\": \"getUserInfo\",\n \"params\": [\n \"UUID\",\n \"Token\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.particle.network/server/rpc/#getUserInfo")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"jsonrpc\": \"2.0\",\n \"id\": 1,\n \"method\": \"getUserInfo\",\n \"params\": [\n \"UUID\",\n \"Token\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.particle.network/server/rpc/#getUserInfo")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"jsonrpc\": \"2.0\",\n \"id\": 1,\n \"method\": \"getUserInfo\",\n \"params\": [\n \"UUID\",\n \"Token\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"jsonrpc": "2.0",
"id": 1,
"result": {
"uuid": "2d7b1ff2-0791-4fd2-a26e-16fbcaefdf8a",
"phone": null,
"email": "U1gphy1mnU@particle.network",
"name": null,
"avatar": null,
"facebookId": null,
"facebookEmail": null,
"googleId": null,
"googleEmail": null,
"appleId": null,
"appleEmail": null,
"twitterId": null,
"twitterEmail": null,
"telegramId": null,
"telegramPhone": null,
"discordId": null,
"discordEmail": null,
"githubId": null,
"githubEmail": null,
"twitchId": null,
"twitchEmail": null,
"microsoftId": null,
"microsoftEmail": null,
"linkedinId": null,
"linkedinEmail": null,
"createdAt": "2022-06-08T07:47:54.000Z",
"updatedAt": "2022-06-08T07:47:55.000Z",
"wallets": [
{
"chain": "evm_chain",
"publicAddress": "0x6D5fCEd0C74F22a1B145ef48B25527Ce9BF829bF"
}
]
}
}