-
Notifications
You must be signed in to change notification settings - Fork 2
/
openapi.yaml
299 lines (297 loc) · 11.6 KB
/
openapi.yaml
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
openapi: 3.0.3
info:
title: IPNI HTTP API
description: The Interplanetary Network Indexer (IPNI) HTTP query API.
version: 0.0.1
paths:
/cid/{cid}:
get:
description: Finds provider records for a given CID by extracting its multihash.
parameters:
- name: cid
in: path
description: The string representation of the CID.
required: true
- $ref: '#/components/parameters/Cascade'
responses:
'200':
description: At least one provider was found successfully.
content:
'application/json':
schema:
$ref: '#/components/schemas/FindResponse'
examples:
providerRecords:
$ref: '#/components/examples/JsonFindResponse'
'application/x-ndjson':
schema:
$ref: '#/components/schemas/ProviderRecord'
examples:
providerRecords:
$ref: '#/components/examples/NDJsonProviderRecords'
'400':
description: The given request is not valid.
content:
text/plain: { }
'404':
description: No results were found for the given CID.
'500':
description: Failure occurred while processing the request.
content:
text/plain: { }
/cid:
options:
description: Returns permitted communication options for lookup by CID.
responses:
204:
$ref: '#/components/responses/FindOptions'
/multihash/{multihash}:
get:
description: Finds provider records for a given multihash
parameters:
- name: multihash
in: path
description: The base58 or hex string representation of the multihash.
required: true
- $ref: '#/components/parameters/Cascade'
responses:
'200':
description: At least one provider was found successfully.
content:
'application/json':
schema:
$ref: '#/components/schemas/FindResponse'
examples:
providerRecords:
$ref: '#/components/examples/JsonFindResponse'
'application/x-ndjson':
schema:
$ref: '#/components/schemas/ProviderRecord'
examples:
providerRecords:
$ref: '#/components/examples/NDJsonProviderRecords'
'400':
description: The given request is not valid.
content:
text/plain: { }
'404':
description: No results were found for the given multihash.
'500':
description: Failure occurred while processing the request.
content:
text/plain: { }
/multihash:
options:
description: Returns permitted communication options for lookup by multihash.
responses:
204:
$ref: '#/components/responses/FindOptions'
post:
description: Batch finds provider records for a given set of multihashes
requestBody:
description: Callback payload
required: true
content:
'application/json':
schema:
$ref: '#/components/schemas/FindResponse'
examples:
providerRecords:
$ref: '#/components/examples/JsonFindResponseMultiple'
responses:
'200':
description: At least one provider was found successfully.
content:
'application/json':
schema:
$ref: '#/components/schemas/FindResponse'
'400':
description: The given request is not valid.
content:
text/plain: { }
'404':
description: No results were found for any of the given multihashs.
'500':
description: Failure occurred while processing the request.
content:
text/plain: { }
components:
schemas:
FindResponse:
type: array
items:
$ref: '#/components/schemas/MultihashResults'
MultihashResults:
type: array
items:
type: object
properties:
Multihash:
type: string
description: base64 string representation of the queried multihash
ProviderResults:
type: array
items:
$ref: '#/components/schemas/ProviderRecord'
ProviderRecord:
type: object
properties:
ContextID:
type: string
description: base64 encoded context ID.
Metadata:
type: string
description: base64 encoded metadata.
Provider:
type: object
properties:
ID:
type: string
description: encoded libp2p peer ID of the provider.
Addrs:
type: array
items:
type: string
description: string representation of the provider multiaddr.
FindRequest:
type: object
properties:
Multihashes:
type: array
description: the list of multihashes for which to find providers.
items:
type: string
description: base64 string representation of the multihash.
examples:
NDJsonProviderRecords:
summary: Streaming provider records response
value: |
{"ContextID":"aXBmcy1kaHQtY2FzY2FkZQ==","Metadata":"gBI=","Provider":{"ID":"12D3KooWHVXoJnv2ifmr9K6LWwJPXxkfvzZRHzjiTZMvybeTnwPy","Addrs":["/ip4/145.40.89.101/tcp/4001","/ip4/145.40.89.101/tcp/4002/ws","/ip4/145.40.89.101/udp/4001/quic","/ip6/2604:1380:45f1:d800::1/tcp/4001","/ip6/2604:1380:45f1:d800::1/tcp/4002/ws","/ip6/2604:1380:45f1:d800::1/udp/4001/quic"]}}
{"ContextID":"aXBmcy1kaHQtY2FzY2FkZQ==","Metadata":"gBI=","Provider":{"ID":"12D3KooWDpp7U7W9Q8feMZPPEpPP5FKXTUakLgnVLbavfjb9mzrT","Addrs":["/ip4/147.75.80.75/tcp/4001","/ip4/147.75.80.75/tcp/4002/ws","/ip4/147.75.80.75/udp/4001/quic","/ip6/2604:1380:4601:f600::5/tcp/4001","/ip6/2604:1380:4601:f600::5/tcp/4002/ws","/ip6/2604:1380:4601:f600::5/udp/4001/quic"]}}
{"ContextID":"aXBmcy1kaHQtY2FzY2FkZQ==","Metadata":"gBI=","Provider":{"ID":"12D3KooWCrBiagtZMzpZePCr1tfBbrZTh4BRQf7JurRqNMRi8YHF","Addrs":["/ip4/147.75.87.65/tcp/4001","/ip4/147.75.87.65/tcp/4002/ws","/ip4/147.75.87.65/udp/4001/quic","/ip6/2604:1380:4601:f600::1/tcp/4001","/ip6/2604:1380:4601:f600::1/tcp/4002/ws","/ip6/2604:1380:4601:f600::1/udp/4001/quic"]}}
JsonFindResponse:
summary: Find response with single multihash
value: |
{
"MultihashResults": [
{
"Multihash": "EiDVNlzli2ONH3OslRv1Q0BRCKUCsERWs3RbthTVu6Xptg==",
"ProviderResults": [
{
"ContextID": "YmFndXFlZXJha3ppdzRwaWxuZmV5ZGFtNTdlZ2RxZTRxZjR4bzVuZmxqZG56emwzanV0YXJtbWltdHNqcQ==",
"Metadata": "gBI=",
"Provider": {
"ID": "QmQzqxhK82kAmKvARFZSkUVS6fo9sySaiogAnx5EnZ6ZmC",
"Addrs": [
"/dns4/elastic.dag.house/tcp/443/wss"
]
}
},
{
"ContextID": "AXESID1YhQwxum55WMSHXI6EQbtVpnhm7QwGpDPYCm5bjwbr",
"Metadata": "kBKjaFBpZWNlQ0lE2CpYKAABgeIDkiAg7H0Gb8ZK4LC8aijKk56XS4diZvoLv9hcDz6iiE0gJhNsVmVyaWZpZWREZWFs9W1GYXN0UmV0cmlldmFs9Q==",
"Provider": {
"ID": "12D3KooW9yi2xLhXds9HC4x9vRN99mphq6ds8qN2YRf8zks1F32G",
"Addrs": [
"/ip4/149.5.22.10/tcp/24002"
]
}
}
]
}
]
}
JsonFindResponseMultiple:
summary: Find response with multiple multihashes
value: |
{
"MultihashResults": [
{
"Multihash": "EiDVNlzli2ONH3OslRv1Q0BRCKUCsERWs3RbthTVu6Xptg==",
"ProviderResults": [
{
"ContextID": "YmFndXFlZXJha3ppdzRwaWxuZmV5ZGFtNTdlZ2RxZTRxZjR4bzVuZmxqZG56emwzanV0YXJtbWltdHNqcQ==",
"Metadata": "gBI=",
"Provider": {
"ID": "QmQzqxhK82kAmKvARFZSkUVS6fo9sySaiogAnx5EnZ6ZmC",
"Addrs": [
"/dns4/elastic.dag.house/tcp/443/wss"
]
}
},
{
"ContextID": "AXESID1YhQwxum55WMSHXI6EQbtVpnhm7QwGpDPYCm5bjwbr",
"Metadata": "kBKjaFBpZWNlQ0lE2CpYKAABgeIDkiAg7H0Gb8ZK4LC8aijKk56XS4diZvoLv9hcDz6iiE0gJhNsVmVyaWZpZWREZWFs9W1GYXN0UmV0cmlldmFs9Q==",
"Provider": {
"ID": "12D3KooW9yi2xLhXds9HC4x9vRN99mphq6ds8qN2YRf8zks1F32G",
"Addrs": [
"/ip4/149.5.22.10/tcp/24002"
]
}
}
],
"Multihash": "oOQCIPNDQHkqUhHx5pVtF6ijer8cljI1oJ0oh710UqcamtuP",
"ProviderResults": [
{
"ContextID": "AXESIHKH83SGwMdaaJZfXNu6yXZtNHLUHT+llGMryKHXG8Wb",
"Metadata": "gBKQEqNoUGllY2VDSUTYKlgoAAGB4gOSICAYVAKmPqL1mpkiiDhd9iBaXoU/3rXorXxzjiyESP4hB2xWZXJpZmllZERlYWz0bUZhc3RSZXRyaWV2YWz1",
"Provider": {
"ID": "12D3KooWE8yt84RVwW3sFcd6WMjbUdWrZer2YtT4dmtj3dHdahSZ",
"Addrs": [
"/ip4/85.11.148.122/tcp/24001"
]
}
}
]
}
]
}
parameters:
Cascade:
name: cascade
in: query
description: |
The comma separated list of routing systems to search for providers in addition to IPNI.
The list of supported routing systems can be discovered by reading `X-IPNI-Allow-Cascade`
response header to `OPTIONS` request.
schema:
type: string
required: false
responses:
FindOptions:
description: Request accepted.
headers:
Access-Control-Allow-Origin:
description: |
The origin permitted to the request.
See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin.
schema:
type: string
Access-Control-Allow-Headers:
description: |
The comma separated list of HTTP headers inspected by the server.
See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Headers
schema:
type: string
Access-Control-Allow-Methods:
description: |
The comma separated list of permitted HTTP methods.
See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Request-Method
schema:
type: string
X-IPNI-Allow-Cascade:
description: |
The comma separated list of supported routing systems onto which the lookup can be cascaded.
The absence of this header implies that the server does not offer cascading lookups.
schema:
type: string
X-IPNI-Legacy-Cascade-Peering:
description: |
The legacy cascade multiaddr to which to peer in order to make content provided only over Bitswap discoverable by an IPNI instance.
This header may be repeated multiple times when the server offers more than one peering address.
The absence of this header implies that the server does not offer legacy cascade peering.
schema:
type: string
externalDocs:
description: IPNI Specification
url: https://github.com/ipni/specs/blob/main/IPNI.md