Repository navigation
Expand file tree
/
Copy pathapi.http
More file actions
99 lines (73 loc) · 2.12 KB
/
Copy pathapi.http
File metadata and controls
99 lines (73 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# Use the VS Code plugin: `REST Client`
@url = http://localhost:7801
@nodeAddr1 = /ip4/8.219.75.114/tcp/6001
@nodeId1 = 16Uiu2HAmS4CErxrmPryJbbEX2HFQbLK8r8xCA5rmzdSU59rHc9AF
@nodeAddr2 = /ip4/122.99.183.54/tcp/6001
@nodeId2 = 16Uiu2HAmRTpigc7jAbsLndB2xDEBMAXLb887SBEFhfdJeEJNtqRM
@nodeAddr3 = /ip4/192.168.1.86/tcp/7001
@nodeId3 = 16Uiu2HAmKk7Fg4WysTpEGd5q1wH2NL4wmxyQ5Nj4HhkQHyB3bDhm
@nodeAddr4 = /ip4/10.0.20.43/tcp/7001
@nodeId4 = 16Uiu2HAmDBYxgdKxeCbmn8hYiqwK3xHR9533WDdEYmpEDQ259GTe
###
# Get the PeerInfo of the node itself
GET {{url}}/api/v0/id HTTP/1.1
Content-Type: application/json
###
# Get peer node list
GET {{url}}/api/v0/peers HTTP/1.1
Content-Type: application/json
###
# Get the PeerInfo of any node
# @prompt node_id The node ID you want to query
POST {{url}}/api/v0/peer HTTP/1.1
Content-Type: application/json
{
"node_id": "{{nodeId1}}"
}
###
# Use AI model image generation
# @prompt node_id The node ID you want to query
# @prompt model The model you want to use
# @prompt prompt The prompt word parameters passed to the model
POST {{url}}/api/v0/image/gen HTTP/1.1
Content-Type: application/json
{
"node_id": "{{nodeId1}}",
"model": "test",
"prompt": "a bird flying in the sky"
}
###
# Get the host information of any node.
POST {{url}}/api/v0/host/info HTTP/1.1
Content-Type: application/json
{
"node_id": "{{nodeId1}}"
}
###
# List the peers with which the node has established connections
POST {{url}}/api/v0/swarm/peers
Content-Type: application/json
###
# List all peers known to this node
POST {{url}}/api/v0/swarm/addrs
Content-Type: application/json
###
# Connect to the specified node
# @prompt node_addr The node address you want to connect to
POST {{url}}/api/v0/swarm/connect
Content-Type: application/json
{
"node_addr": "{{nodeAddr4}}/p2p/{{nodeId4}}"
}
###
# Disconnect from the specified node
# @prompt node_addr The node address you want to disconnect from
POST {{url}}/api/v0/swarm/disconnect
Content-Type: application/json
{
"node_addr": "{{nodeAddr4}}/p2p/{{nodeId4}}"
}
###
# List the topic subscribers known to this node
POST {{url}}/api/v0/pubsub/peers
Content-Type: application/json