Skip to content

Commit 8784fdc

Browse files
committed
docs: format and update test endpoints
1 parent 3dbf12a commit 8784fdc

File tree

1 file changed

+206
-43
lines changed

1 file changed

+206
-43
lines changed

README.md

Lines changed: 206 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -46,74 +46,237 @@ These steps should ensure a smooth transition to the latest version of `indexer-
4646

4747
[Contributions guide](/contributing.md)
4848

49-
### Supported request and response format examples
49+
## Supported request and response format examples
5050

51+
```bash
52+
curl http://localhost:7600/
53+
```
54+
```
55+
Service is up and running
5156
```
52-
✗ curl http://localhost:7300/
53-
Ready to roll!
54-
55-
✗ curl http://localhost:7300/health
56-
{"healthy":true}
5757

58-
✗ curl http://localhost:7300/version
59-
{"version":"0.1.0","dependencies":{}}
58+
```bash
59+
curl http://localhost:7600/version
60+
```
61+
```json
62+
{ "version":"0.1.0", "dependencies": {..} }
63+
```
6064

61-
✗ curl http://localhost:7300/operator/info
62-
{"publicKey":"0xacb05407d78129b5717bb51712d3e23a78a10929"}
65+
```bash
66+
curl http://localhost:7600/info
67+
```
68+
```json
69+
{ "publicKey": "0xacb05407d78129b5717bb51712d3e23a78a10929" }
70+
```
6371

6472
# Subgraph queries
65-
# Checks for receipts and authorization
66-
✗ curl -X POST -H 'Content-Type: application/json' -H 'Authorization: Bearer token-for-graph-node-query-endpoint' --data '{"query": "{_meta{block{number}}}"}' http://localhost:7300/subgraphs/id/QmacQnSgia4iDPWHpeY6aWxesRFdb8o5DKZUx96zZqEWrB
67-
"{\"data\":{\"_meta\":{\"block\":{\"number\":9425787}}}}"
68-
73+
## Checks for receipts and authorization
74+
```bash
75+
curl -X POST \
76+
-H 'Content-Type: application/json' \
77+
-H 'Authorization: Bearer token-for-graph-node-query-endpoint' \
78+
--data '{"query": "{_meta{block{number}}}"}' \
79+
http://localhost:7600/subgraphs/id/QmacQnSgia4iDPWHpeY6aWxesRFdb8o5DKZUx96zZqEWrB
80+
```
81+
```json
82+
{
83+
"attestable": true,
84+
"graphQLResponse": "{\"data\":{\"_meta\":{\"block\":{\"number\":10666745}}}}"
85+
}
86+
```
6987
# Takes hex representation for subgraphs deployment id aside from IPFS hash representation
70-
✗ curl -X POST -H 'Content-Type: application/json' -H 'Authorization: Bearer token-for-graph-node-query-endpoint' --data '{"query": "{_meta{block{number}}}"}' http://localhost:7300/subgraphs/id/0xb655ca6f49e73728a102219726ff678d61d8fb792874792e9f0d9887dc616600
71-
"{\"data\":{\"_meta\":{\"block\":{\"number\":9425787}}}}"
88+
```bash
89+
curl -X POST \
90+
-H 'Content-Type: application/json' \
91+
-H 'Authorization: Bearer token-for-graph-node-query-endpoint' \
92+
--data '{"query": "{_meta{block{number}}}"}' \
93+
http://localhost:7600/subgraphs/id/0xb655ca6f49e73728a102219726ff678d61d8fb792874792e9f0d9887dc616600
94+
```
95+
```json
96+
{
97+
"attestable": true,
98+
"graphQLResponse": "{\"data\":{\"_meta\":{\"block\":{\"number\":10666745}}}}"
99+
}
100+
```
72101

73102
# Free query auth token check failed
74-
✗ curl -X POST -H 'Content-Type: application/json' -H 'Authorization: blah' --data '{"query": "{_meta{block{number}}}"}' http://localhost:7300/subgraphs/id/0xb655ca6f49e73728a102219726ff678d61d8fb792874792e9f0d9887dc616600
75-
"Invalid Tap-Receipt header provided"%
76-
77-
# Subgraph health check
103+
```bash
104+
curl -X POST \
105+
-H 'Content-Type: application/json' \
106+
-H 'Authorization: blah' \
107+
--data '{"query": "{_meta{block{number}}}"}' \
108+
http://localhost:7600/subgraphs/id/0xb655ca6f49e73728a102219726ff678d61d8fb792874792e9f0d9887dc616600
109+
```
110+
```json
111+
{
112+
"message":"No valid receipt or free query auth token provided"
113+
}
114+
```
115+
<!-- # Subgraph health check
78116
✗ curl http://localhost:7300/subgraphs/health/QmVhiE4nax9i86UBnBmQCYDzvjWuwHShYh7aspGPQhU5Sj
79117
"Subgraph deployment is up to date"%
80118
## Unfound subgraph
81119
✗ curl http://localhost:7300/subgraphs/health/QmacQnSgia4iDPWHpeY6aWxesRFdb8o5DKZUx96zZqEWrB
82-
"Invalid indexing status"%
120+
"Invalid indexing status"% -->
83121

84122
# Network queries
85-
# Checks for auth and configuration to serve-network-subgraph
86-
✗ curl -X POST -H 'Content-Type: application/json' -H 'Authorization: token-for-network-subgraph' --data '{"query": "{_meta{block{number}}}"}' http://localhost:7300/network
87-
"Not enabled or authorized query"
123+
## Checks for auth and configuration to serve-network-subgraph
124+
125+
```bash
126+
curl -X POST \
127+
-H 'Content-Type: application/json' \
128+
-H 'Authorization: token-for-network-subgraph' \
129+
--data '{"query": "{_meta{block{number}}}"}' \
130+
http://localhost:7600/network
131+
```
132+
```json
133+
{
134+
"message":"No valid receipt or free query auth token provided"
135+
}
136+
```
88137

89138
# Indexing status resolver - Route supported root field queries to graph node status endpoint
90-
✗ curl -X POST -H 'Content-Type: application/json' --data '{"query": "{blockHashFromNumber(network:\"goerli\", blockNumber: 9069120)}"}' http://localhost:7300/status
91-
{"data":{"blockHashFromNumber":"e1e5472636db73ba5496aee098dc21310683c95eb30fc46f9ba6c36d8b28d58e"}}%
139+
```bash
140+
curl -X POST \
141+
-H 'Content-Type: application/json' \
142+
--data '{"query": "{blockHashFromNumber(network:\"mainnet\", blockNumber: 21033)}"}' \
143+
http://localhost:7600/status
144+
```
145+
```json
146+
{
147+
"data": {
148+
"blockHashFromNumber": "0x6d8daae97a562b1fff22162515452acdd817c3d3c5cde1497b7d9eb6666a957e"
149+
}
150+
}
151+
```
92152

93-
# Indexing status resolver -
94-
✗ curl -X POST -H 'Content-Type: application/json' --data '{"query": "{indexingStatuses {subgraph health} }"}' http://localhost:7300/status
95-
{"data":{"indexingStatuses":[{"subgraph":"QmVhiE4nax9i86UBnBmQCYDzvjWuwHShYh7aspGPQhU5Sj","health":"healthy"},{"subgraph":"QmWVtsWk8Pqn3zY3czDjyoVreshRLmoz9jko3mQ4uvxQDj","health":"healthy"},{"subgraph":"QmacQnSgia4iDPWHpeY6aWxesRFdb8o5DKZUx96zZqEWrB","health":"healthy"}]}}
153+
## Indexing status resolver -
154+
```bash
155+
curl -X POST \
156+
-H 'Content-Type: application/json' \
157+
--data '{"query": "{indexingStatuses {subgraph health}}"}' \
158+
http://localhost:7600/status
159+
```
160+
```json
161+
{
162+
"data": {
163+
"indexingStatuses": [
164+
{
165+
"subgraph": "QmVhiE4nax9i86UBnBmQCYDzvjWuwHShYh7aspGPQhU5Sj",
166+
"health": "healthy"
167+
},
168+
{
169+
"subgraph": "QmWVtsWk8Pqn3zY3czDjyoVreshRLmoz9jko3mQ4uvxQDj",
170+
"health": "healthy"
171+
},
172+
{
173+
"subgraph": "QmacQnSgia4iDPWHpeY6aWxesRFdb8o5DKZUx96zZqEWrB",
174+
"health": "healthy"
175+
}
176+
]
177+
}
178+
}
179+
```
96180

97-
# Indexing status resolver - Filter out the unsupported queries
98-
✗ curl -X POST -H 'Content-Type: application/json' --data '{"query": "{_meta{block{number}}}"}' http://localhost:7300/status
99-
{"errors":[{"locations":[{"line":1,"column":2}],"message":"Type `Query` has no field `_meta`"}]}%
181+
## Indexing status resolver - Filter out the unsupported queries
182+
```bash
183+
curl -X POST \
184+
-H 'Content-Type: application/json' \
185+
--data '{"query": "{_meta{block{number}}}"}' \
186+
http://localhost:7600/status
187+
```
188+
```json
189+
{
190+
"errors": [
191+
{
192+
"locations": [
193+
{
194+
"line": 1,
195+
"column": 2
196+
}
197+
],
198+
"message": "Type `Query` has no field `_meta`"
199+
}
200+
]
201+
}
202+
```
100203

101-
######## Cost server - read-only graphql query
102-
curl -X GET -H 'Content-Type: application/json' --data '{"query": "{ costModel(deployment: \"Qmb5Ysp5oCUXhLA8NmxmYKDAX2nCMnh7Vvb5uffb9n5vss\") { deployment model variables }} "}' http://localhost:7300/cost
204+
## Cost server - read-only graphql query
205+
```bash
206+
curl -X GET \
207+
-H 'Content-Type: application/json' \
208+
--data '{"query": "{ costModel(deployment: \"Qmb5Ysp5oCUXhLA8NmxmYKDAX2nCMnh7Vvb5uffb9n5vss\") { deployment model variables }} "}' \
209+
http://localhost:7300/cost
210+
```
211+
```json
212+
{
213+
"data": {
214+
"costModel": {
215+
"deployment": "0xbd499f7673ca32ef4a642207a8bebdd0fb03888cf2678b298438e3a1ae5206ea",
216+
"model": "default => 0.00025;",
217+
"variables": null
218+
}
219+
}
220+
}
221+
```
103222

104-
curl -X GET -H 'Content-Type: application/json' --data '{"query": "{ costModel(deployment: \"Qmb5Ysp5oCUXhLA8NmxmYKDAX2nCMnh7Vvb5uffb9n5vss\") { deployment model variables }} "}' http://localhost:7300/cost
105-
{"data":{"costModel":{"deployment":"0xbd499f7673ca32ef4a642207a8bebdd0fb03888cf2678b298438e3a1ae5206ea","model":"default => 0.00025;","variables":null}}}%
223+
```bash
224+
curl -X GET \
225+
-H 'Content-Type: application/json' \
226+
--data '{"query": "{ costModel(deployment: \"Qmb5Ysp5oCUXhLA8NmxmYKDAX2nCMnh7Vvb5uffb9n5vas\") { deployment model variables }} "}' \
227+
http://localhost:7300/cost
228+
```
229+
```json
230+
{
231+
"data": {
232+
"costModel": null
233+
}
234+
}
235+
```
106236

107-
curl -X GET -H 'Content-Type: application/json' --data '{"query": "{ costModel(deployment: \"Qmb5Ysp5oCUXhLA8NmxmYKDAX2nCMnh7Vvb5uffb9n5vas\") { deployment model variables }} "}' http://localhost:7300/cost
108-
{"data":{"costModel":null}}%
237+
```bash
238+
curl -X GET \
239+
-H 'Content-Type: application/json' \
240+
--data '{"query": "{ costModel(deployment: \"Qmb5Ysp5oCUXhLA8NmxmYKDAX2nCMnh7Vvb5uffb9n5vss\") { deployment odel variables }} "}' \
241+
http://localhost:7300/cost
242+
```
243+
```json
244+
{
245+
"errors": [
246+
{
247+
"message": "Cannot query field \"odel\" on type \"CostModel\". Did you mean \"model\"?",
248+
"locations": [
249+
{
250+
"line": 1,
251+
"column": 88
252+
}
253+
]
254+
}
255+
]
256+
}
257+
```
109258

110-
curl -X GET -H 'Content-Type: application/json' --data '{"query": "{ costModel(deployment: \"Qmb5Ysp5oCUXhLA8NmxmYKDAX2nCMnh7Vvb5uffb9n5vss\") { deployment odel variables }} "}' http://localhost:7300/cost
111-
{"errors":[{"message":"Cannot query field \"odel\" on type \"CostModel\". Did you mean \"model\"?","locations":[{"line":1,"column":88}]}]}%
259+
```bash
260+
curl -X GET \
261+
-H 'Content-Type: application/json' \
262+
--data '{"query": "{ costModels(deployments: [\"Qmb5Ysp5oCUXhLA8NmxmYKDAX2nCMnh7Vvb5uffb9n5vss\"]) { deployment model variables }} "}' \
263+
http://localhost:7300/cost
264+
```
265+
```json
266+
{
267+
"data": {
268+
"costModels": [
269+
{
270+
"deployment": "0xbd499f7673ca32ef4a642207a8bebdd0fb03888cf2678b298438e3a1ae5206ea",
271+
"model": "default => 0.00025;",
272+
"variables": null
273+
}
274+
]
275+
}
276+
}
277+
```
112278

113-
curl -X GET -H 'Content-Type: application/json' --data '{"query": "{ costModels(deployments: [\"Qmb5Ysp5oCUXhLA8NmxmYKDAX2nCMnh7Vvb5uffb9n5vss\"]) { deployment model variables }} "}' http://localhost:7300/cost
114-
{"data":{"costModels":[{"deployment":"0xbd499f7673ca32ef4a642207a8bebdd0fb03888cf2678b298438e3a1ae5206ea","model":"default => 0.00025;","variables":null}]}}%
115279

116-
```
117280

118281
## Dependency choices
119282

0 commit comments

Comments
 (0)