The Server API provides useful APIs to support application use. It follows a JSON-RPC 2.0 standard.
The Server RPC URL is:
{% hint style="info" %} https://api.particle.network/server/rpc {% endhint %}
Obtain user info by uuid and token
Use this API to integrate Particle Auth into your user ID system 🎉
Parameters:
<string>
- user uuid<string>
- user token
Results:
<object>
- a JSON object containing:uuid: <string>
, user uuidphone: <string>
, user phone numberemail: <string>
, user emailname: <string>
, user nameavatar: <string>
, user avatar urlfacebookId: <string>
, exist when user login with facebookfacebookEmail: <string>
googleId: <string>
, exist when user login with googlegoogleEmail: <string>
appleId: <string>
, exist when user login with appleappleEmail: <string>
twitterId: <string>
, exist when user login with twittertwitterEmail: <string>
telegramId: <string>
, exist when user login with telegramtelegramPhone: <string>
discordId: <string>
, exist when user login with discorddiscordEmail: <string>
githubId: <string>
, exist when user login with githubgithubEmail: <string>
twitchId: <string>
, exist when user login with twitchtwitchEmail: <string>
miscrosoftId: <string>
, exist when user login with miscrosoftmiscrosoftEmail: <string>
linkedinId: <string>
, exist when user login with linkedinlinkedinEmail: <string>
jwtId: <string>
, exist when user login with JWT(Custom Auth)- Format:
projectId + : + jwt unique id
- Format:
wallets: <[object]>
, user wallets with public address
{% tabs %} {% tab title="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);
})();
{% endtab %}
{% tab title="Curl" %}
curl 'https://api.particle.network/server/rpc' \
--header 'Authorization: Basic YmEwNTA5ZTctZThiYi00MzY2LTg5YjctYjM5ZjAyYmNkMDg0OmNnZjE4YXNMbG9zSkJzZlZXbWxvNHNuZ2lFRVZzc1gzNHFlTUxmZzQ=' \
-X POST -H "Content-Type: application/json" -d '
{"jsonrpc":"2.0","id":0,"method":"getUserInfo","params":["Particle Auth User Uuid", "Particle Auth User Token"]}
'
{% endtab %} {% endtabs %}
👉 Sign up/log in and create your project now
Response example:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"uuid": "2d7b1ff2-0791-4fd2-a26e-16fbcaefdf8a",
"phone": null,
"email": "[email protected]",
"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"
},
{
"chain": "solana",
"publicAddress": "3k61BRDo253SF1XuknbBSUh8FvFqJkcMYzmZuvMMhCC1"
}
]
}
}
Check if the user's address has interacted with your project
Parameters:
<string>
- chain, wallets chain name, the type value is as belowsolana
evm_chain
<string>
- user address
{% hint style="info" %} Only verified contract can be locked for user wallet, please add and verify your contract/program address first 👉 Dashboard, and testnet will not check the contract is verified. {% endhint %}
Results:
<bool>
{% tabs %} {% tab title="Javascript" %}
const axios = require("axios");
(async () => {
const response = await axios.post(
"https://api.particle.network/server/rpc",
{
jsonrpc: "2.0",
id: 0,
method: "isProjectUser",
params: ["evm_chain", "0x6D5fCEd0C74F22a1B145ef48B25527Ce9BF829bF"],
},
{
auth: {
username: "Your Project Id",
password: "Your Project Server Key",
},
}
);
console.log(response.data);
})();
{% endtab %}
{% tab title="Curl" %}
curl 'https://api.particle.network/server/rpc' \
--header 'Authorization: Basic YmEwNTA5ZTctZThiYi00MzY2LTg5YjctYjM5ZjAyYmNkMDg0OmNnZjE4YXNMbG9zSkJzZlZXbWxvNHNuZ2lFRVZzc1gzNHFlTUxmZzQ=' \
-X POST -H "Content-Type: application/json" -d '
{"jsonrpc":"2.0","id":0,"method":"isProjectUser","params":["evm_chain","0x6D5fCEd0C74F22a1B145ef48B25527Ce9BF829bF"]}
'
{% endtab %} {% endtabs %}
Response example:
{
"jsonrpc": "2.0",
"id": 0,
"result": true
}