JSON RPC
Overview
JSON RPC allows making remote procedure protocol network requests encoded in JSON.
It is similar to the XML-RPC protocol, defining only a few data types and commands.
JSON-RPC allows for notifications (data sent to the server that does not require a response) and for multiple calls to be sent to the server which may be answered asynchronously.
More details in JSON RPC Wikipedia and JSON RPC Specification
Configuration
Target Path (targetPath)- thedocnode you wish the existingdocnodes to be attached toEndpoint (endpoint)URL (endpoint.url)- the url to which to execute the JSON RPC callHTTP Method (endpoint.httpMethod)- the http method for the call
JSON-RPC Request Object (jsonRpc)- allows setting multipleJSON-RPC Method Name (jsonRpc[].method)- method name for the callJSON-RPC ID (jsonRpc[].id)JSON-RPC Params (jsonRpc[].params)
Query Params (queryParams)- The query params to send in the rest requestHTTP Headers (headers)- The HTTP headers to send in the rest requestCache Results (cacheble)- if checked will store the response in ACE cacheCache Key (cacheKey)- if specified, will be used as key to store the cached responseCache clean-up condition (cacheCleanupCondition)- If condition is true, then step cache is cleared, else if condition is false or not defined, then step behaves as usually.TTL cache (minutes) (ttl)- time for how long in minutes to hold the results in cache
Examples
Example flow
tags:
- general
steps:
- stepType: jsonrpc
config:
endpoint:
url: " https://api.devnet.solana.com"
httpMethod: POST
jsonRpc:
- params: []
id: "1"
method: getBlockHeight
targetPath: result
headers:
Content-Type: application/json
queryParams: {}
name: JSON-RPC2.0
description: ""
condition: ""
sampleData: {}
Flow Result
{
"doc": {
"result": {
"jsonrpc": "2.0",
"result": 170132414,
"id": "1"
}
},
"errors": [],
"performance": {
"steps": [
{
"step": "jsonrpc",
"executionTime": 508
}
],
"executionTimeOfFlow": 508,
"timeMetric": "ms"
}
}