-
Notifications
You must be signed in to change notification settings - Fork 1
/
json_api_v2.yaml
88 lines (82 loc) · 4.33 KB
/
json_api_v2.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
openapi: 3.1.0
info:
title: XRP Ledger Public API
description: A JSON RPC API used to query rippled.
license:
name: MIT License
identifier: mit
url: https://opensource.org/license/mit/
version: 2.0.0
servers:
# TODO: Should this list contain non-ripple servers? All UNL ws_urls? Just public infrastructure?
- url: https://s1.ripple.com:51234
description: Mainnet Public API server
# TODO: Should testnet / devnet / xahau / etc. be on this list?
- url: https://s.altnet.rippletest.net:51234
description: Testnet (not for production usage)
paths:
# We use OpenAPI's discriminator field with the `method` name to delineate between the options
/:
post:
summary: Send JSON-RPC request to server
requestBody:
description: JSON-RPC request object
content:
application/json:
schema:
discriminator:
propertyName: method
mapping:
account_channels: 'requests/account_channels_open_api.yaml#/components/schemas/AccountChannelsRequest' # TODO: Verify this is the correct syntax
account_info: 'requests/account_info_open_api.yaml#/components/schemas/AccountInfoRequest'
submit: 'requests/submit_open_api.yaml#/components/schemas/SubmitRequestV2'
account_lines: 'requests/account_lines_open_api.yaml#/components/schemas/AccountLinesRequest'
ledger_entry: 'requests/ledger_entry_open_api.yaml#/components/schemas/LedgerEntryRequest'
# TODO: Add the rest of the JSON RPC requests here
oneOf:
- $ref: 'requests/account_channels_open_api.yaml#/components/schemas/AccountChannelsRequest'
- $ref: 'requests/account_info_open_api.yaml#/components/schemas/AccountInfoRequest'
- $ref: 'requests/submit_open_api.yaml#/components/schemas/SubmitRequestV2'
- $ref: 'requests/account_lines_open_api.yaml#/components/schemas/AccountLinesRequest'
- $ref: 'requests/ledger_entry_open_api.yaml#/components/schemas/LedgerEntryRequest'
# TODO: Add the rest of the JSON RPC requests here
required: true
operationId: 'POST'
responses:
'200':
description: JSON-RPC response object
content:
application/json:
schema:
oneOf:
- $ref: 'requests/account_channels_open_api.yaml#/components/schemas/AccountChannelsResponse'
- $ref: 'requests/account_info_open_api.yaml#/components/schemas/AccountInfoResponseV2'
- $ref: 'requests/submit_open_api.yaml#/components/schemas/SubmitResponseV2'
- $ref: 'requests/account_lines_open_api.yaml#/components/schemas/AccountLinesResponse'
- $ref: 'requests/ledger_entry_open_api.yaml#/components/schemas/LedgerEntryResponse'
# TODO: Add the rest of the JSON RPC responses here
# TODO: We want to be much more explicit with http error codes for a full implementation of this spec.
# (Eventually the goal should be removing the '4XX' because all cases are covered)
# TODO: We also should investigate if some commands in rippled have unique http error codes / responses for common error code
# which are not shared across commands. (If so they should also be documented here)
'4XX':
description: JSON-RPC http error. The response is a plain-text explanation with the http error code and description in the response body.
content:
text/plain:
schema:
type: string
'5XX':
description: JSON-RPC http error. The response is a plain-text explanation with the http error code and description in the response body.
content:
text/plain:
schema:
type: string
'503':
description: An error for when the client is over the server's rate limit.
content:
text/plain:
schema:
type: string
enum:
- "503 Service Unavailable\n\nServer is overloaded" # TODO: Validate that this is the right string, it's unclear whether 503 is included in the response: https://xrpl.org/rate-limiting.html#json-rpc-rate-limited-error
security: []