Data & Operations
This section provides detailed references for GraphQL queries used to fetch operational data from your Blocklet Server. These queries are essential for monitoring system health, managing backups, auditing activities, and gaining insights into traffic patterns. For mutations related to data and operations, see the Data & Operations Mutations section.
Backups#
Manage and monitor blocklet backup records.
getBlockletBackups#
Retrieves a list of backup records for a specific blocklet, optionally filtered by a time range.
Parameters
Example Usage
import BlockletServerClient from '@blocklet/server-js';
const client = new BlockletServerClient();
const backups = await client.getBlockletBackups({
input: { did: 'z8ia22V5CfqF2e4sAFc9a2B9z9mC6a8x461sC' }
});
console.log(backups);Example Response
{
"code": "ok",
"backups": [
{
"appPid": "z8ia22V5CfqF2e4sAFc9a2B9z9mC6a8x461sC",
"userDid": "z1...",
"strategy": 1,
"sourceUrl": "/path/to/backup",
"target": "disk",
"targetName": "Local Disk",
"targetUrl": "/path/to/backup/target",
"createdAt": 1678886400,
"updatedAt": 1678886400,
"status": 1,
"message": "Backup completed successfully",
"progress": 100,
"metadata": {}
}
]
}getBlockletBackupSummary#
Retrieves a summary of backup activities, including success and error counts, for a blocklet within a specified time range, grouped by date.
Parameters
Example Usage
import BlockletServerClient from '@blocklet/server-js';
const client = new BlockletServerClient();
const summary = await client.getBlockletBackupSummary({
input: { did: 'z8ia22V5CfqF2e4sAFc9a2B9z9mC6a8x461sC' }
});
console.log(summary);Example Response
{
"code": "ok",
"summary": [
{
"date": "2023-03-15",
"successCount": 5,
"errorCount": 1
}
]
}Logs#
Access audit and activity logs for monitoring and troubleshooting.
getAuditLogs#
Fetches a paginated list of audit logs, allowing you to track activities across the node. You can filter logs by scope, category, and content.
Parameters
Example Usage
import BlockletServerClient from '@blocklet/server-js';
const client = new BlockletServerClient();
const logs = await client.getAuditLogs({
input: {
paging: { page: 1, pageSize: 10 },
category: 'user'
}
});
console.log(logs);Example Response
{
"code": "ok",
"list": [
{
"id": "...",
"scope": "node",
"category": "user",
"action": "login",
"content": "User z1... logged in",
"actor": {
"did": "z1...",
"role": "owner",
"fullName": "Alice"
},
"env": {},
"createdAt": 1678886400,
"ip": "127.0.0.1",
"ua": "Mozilla/5.0..."
}
],
"paging": {
"total": 1,
"pageSize": 10,
"pageCount": 1,
"page": 1See all 2 lines
getPassportLogs#
Retrieves activity logs for a specific passport, tracking actions such as issuance, revocation, and usage.
Parameters
Example Usage
import BlockletServerClient from '@blocklet/server-js';
const client = new BlockletServerClient();
const logs = await client.getPassportLogs({
input: {
teamDid: 'z8ia22V5CfqF2e4sAFc9a2B9z9mC6a8x461sC',
query: { passportId: 'zpassport_...' },
paging: { page: 1, pageSize: 10 }
}
});
console.log(logs);Example Response
{
"passportLogs": [
{
"id": 1,
"passportId": "zpassport_...",
"action": "issued",
"operatorIp": "127.0.0.1",
"operatorUa": "Mozilla/5.0...",
"operatorDid": "z1...",
"metadata": {},
"createdAt": 1678886400
}
],
"paging": {
"total": 1,
"pageSize": 10,
"pageCount": 1,
"page": 1
}
}Analytics & Insights#
Gain insights into blocklet performance and usage.
getTrafficInsights#
Provides traffic analytics for a specific blocklet, including request counts, unique visitors, and bandwidth usage within a specified date range.
Parameters
Example Usage
import BlockletServerClient from '@blocklet/server-js';
const client = new BlockletServerClient();
const insights = await client.getTrafficInsights({
input: {
did: 'z8ia22V5CfqF2e4sAFc9a2B9z9mC6a8x461sC',
startDate: '2023-01-01',
endDate: '2023-01-31'
}
});
console.log(insights);Example Response
{
"code": "ok",
"list": [
{
"did": "z8ia22V5CfqF2e4sAFc9a2B9z9mC6a8x461sC",
"date": "2023-01-15",
"totalRequests": 1500,
"uniqueVisitors": 200,
"bandwidth": 512000000
}
],
"paging": {
"total": 1,
"pageSize": 10,
"pageCount": 1,
"page": 1
}
}You now have the tools to query operational data from your Blocklet Server. To learn how to manage publishing workflows and project resources, proceed to the Publishing & Projects section.