-
Notifications
You must be signed in to change notification settings - Fork 5
API Docs
李大狗 edited this page May 8, 2022
·
9 revisions
获取所有的codes,可以根据without_content
选择是否返回详细的内容。
标题 | 描述 |
---|---|
接口路径 | /api/v1/get_codes |
Method | GET |
Content-Type | application/json |
Query Params:
Key | Type | Value | Required |
---|---|---|---|
without_content | bool | true | N |
返回值:
[
{
"description": " This is an code-on-chain example:\n Shows how to get the current block height on dif chain.\n",
"id": 1,
"inserted_at": "2022-03-16T12:26:47",
"name": "BestBlockHeightGetter",
"tx_id": "-6TxJsLSeoXfEhKfGzG5-n65QpAbuiwp4fO_7-2A-vA",
"updated_at": "2022-03-16T12:26:47"
},
{
"description": " Provide Endopoints of multi-chain by func\n",
"id": 2,
"inserted_at": "2022-03-16T12:26:48",
"name": "EndpointProvider",
"tx_id": "ghBIjdbs2HpGM0Huy3IV0Ynm9OOWxDLkcW6q0X7atqs",
"updated_at": "2022-03-16T12:26:48"
},
...
]
根据name或者tx_id获取对应的code。
标题 | 描述 |
---|---|
接口路径 | /api/v1/get_code |
Method | POST |
Content-Type | application/json |
Query Params:
Key | Type | Value | Required |
---|---|---|---|
name | string | hello | Y/N |
tx_id | string | 21 | Y/N |
返回值:
{
"code": "defmodule CodesOnChain.EndpointProvider do\n @moduledoc \"\"\"\n Provide Endopoints of multi-chain by func\n \"\"\"\n\n @endpoints %{\n \"ethereum\" => \"https://mainnet.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161\",\n \"polygon\" => \"https://polygon-rpc.com\",\n \"moonbeam\" => \"https://rpc.api.moonbeam.network\",\n \"arweave\" => \"https://arweave.net\"\n }\n\n def get_module_doc, do: @moduledoc\n\n @spec get_endpoints() :: map()\n def get_endpoints(), do: @endpoints\n\nend\n"
}
/api/v1/run?name=EndpointProvider&func_name=get_endpoints
BODY:
{
"params": [params_list]
}
向指定code的function提供参数并运行函数。
An Example:
curl --location --request POST 'https://faas.noncegeek.com/api/v1/run?name=EndpointProvider&func_name=get_endpoints' \
--header 'Content-Type: application/json' \
--data-raw '{
"params": []
}'
标题 | 描述 |
---|---|
接口路径 | /api/v1/run |
Method | POST |
Content-Type | application/json |
Query Params:
Key | Type | Value | Required |
---|---|---|---|
name | string | "EndpointProvider" | Y/N |
func_name | string | "get_endpoints" | Y/N |
Post Data:
{
"params": [params_list]
}
返回值:
{
"result": {
"arweave": "https://arweave.net",
"ethereum": "https://mainnet.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161",
"moonbeam": "https://rpc.api.moonbeam.network",
"polygon": "https://polygon-rpc.com"
}
}