Server API
The Server API provides useful APIs to support application use. It follows a JSON-RPC 2.0 standard.
The Server RPC URL is:
https://api.particle.network/server/rpc
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
wallets: <[object]>
, user wallets with public address
Javascript
Curl
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);
})();
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"]}
'
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"
}
]
}
}
Lock user wallet transactions for a contract/program up for a while
Parameters:
<string>
- user uuid<string>
- user token<object>
- a JSON object containing:chain: <string>
, wallets chain name, the type value is as belowsolana
evm_chain
publicAddress: <string>
, user wallet public addresscontractAddress: <string>
, your contract/program addresstime: <uint64>
, lock time(seconds), and max lock time is 86400(24hours)
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.
Results:
empty string
Javascript
Curl
const axios = require("axios");
(async () => {
const response = await axios.post(
"https://api.particle.network/server/rpc",
{
jsonrpc: "2.0",
id: 0,
method: "lockUserWallet",
params: ["Particle Auth User Uuid", "Particle Auth User Token", {
"chain": "evm_chain",
"chainId": 42,
"publicAddress": "0x6D5fCEd0C74F22a1B145ef48B25527Ce9BF829bF",
"contractAddress": "0x27833fBD4FA313A11653D1D2372cB89f5f2D2f62",
"time": 3600
}],
},
{
auth: {
username: "Your Project Id",
password: "Your Project Server Key",
},
}
);
console.log(response.data);
})();
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", {"chain": "evm_chain", "chainId": 42, "publicAddress": "0x6D5fCEd0C74F22a1B145ef48B25527Ce9BF829bF", "contractAddress": "0x27833fBD4FA313A11653D1D2372cB89f5f2D2f62", "time": 3600}]}
'
Response example:
{
"jsonrpc": "2.0",
"id": 1,
"result": ""
}
Unlock user wallet transactions for a contract/program
Parameters:
<string>
- user uuid<string>
- user token<object>
- a JSON object containing:
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.
Results:
empty string
Javascript
Curl
const axios = require("axios");
(async () => {
const response = await axios.post(
"https://api.particle.network/server/rpc",
{
jsonrpc: "2.0",
id: 0,
method: "unlockUserWallet",
params: ["Particle Auth User Uuid", "Particle Auth User Token", {
"chain": "evm_chain",
"chainId": 42,
"publicAddress": "0x6D5fCEd0C74F22a1B145ef48B25527Ce9BF829bF",
"contractAddress": "0x27833fBD4FA313A11653D1D2372cB89f5f2D2f62"
}],
},
{
auth: {
username: "Your Project Id",
password: "Your Project Server Key",
},
}
);
console.log(response.data);
})();
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", {"chain": "evm_chain", "chainId": 42, "publicAddress": "0x6D5fCEd0C74F22a1B145ef48B25527Ce9BF829bF", "contractAddress": "0x27833fBD4FA313A11653D1D2372cB89f5f2D2f62"}]}
'
Response example:
{
"jsonrpc": "2.0",
"id": 1,
"result": ""
}
Last modified 4mo ago