mirror of
https://github.com/logos-messaging/docs.waku.org.git
synced 2026-01-02 12:53:12 +00:00
add REST API refs
This commit is contained in:
parent
582b5bb99d
commit
9ac33ce9e8
@ -26,7 +26,7 @@ Certain features in `@waku/sdk` are tailored for browsers and might not translat
|
||||
|
||||
## Recommendations
|
||||
|
||||
Before using `@waku/sdk` in a NodeJS environment, take into account these limitations. For a more optimised solution, we recommend [running nwaku in a Docker container](/guides/nwaku/run-docker) and consuming its [JSON RPC API](https://rfc.vac.dev/spec/16/).
|
||||
Before using `@waku/sdk` in a NodeJS environment, take into account these limitations. For a more optimised solution, we recommend [running nwaku in a Docker container](/guides/nwaku/run-docker) and consuming its [REST API](https://waku-org.github.io/waku-rest-api/).
|
||||
|
||||
## Future Developments
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@ Waku provides integrations tailored for mobile applications, enabling Waku to ru
|
||||
|
||||
| | Description | Documentation |
|
||||
| - | - | - |
|
||||
| JSON-RPC API | `JSON-RPC` API interface provided by `nwaku` and `go-waku` to interact with the Waku Network | COMING SOON |
|
||||
| [REST API](https://waku-org.github.io/waku-rest-api/) | REST API interface provided by `nwaku` and `go-waku` to interact with the Waku Network | [Waku Node REST API Spec](https://waku-org.github.io/waku-rest-api/) |
|
||||
| [@waku/react](https://www.npmjs.com/package/@waku/react) | React components and UI adapters designed for seamless integration with `@waku/sdk` | COMING SOON |
|
||||
| [@waku/create-app](https://www.npmjs.com/package/@waku/create-app) | Starter kit to bootstrap your next `@waku/sdk` project from various example templates | [Bootstrap DApps Using @waku/create-app](/guides/js-waku/use-waku-create-app) |
|
||||
| [nwaku-compose](https://github.com/waku-org/nwaku-compose) | Pre-configured Docker Compose setup for running and monitoring a `nwaku` node using Prometheus and Grafana | [Run Nwaku with Docker Compose](/guides/nwaku/run-docker-compose) |
|
||||
@ -71,25 +71,28 @@ Your `nwaku` node provides a [REST API](https://waku-org.github.io/waku-rest-api
|
||||
|
||||
```shell
|
||||
# Get nwaku version
|
||||
curl http://127.0.0.1:8645/debug/v1/version
|
||||
curl --location 'http://127.0.0.1:8645/debug/v1/version'
|
||||
|
||||
# Get nwaku info
|
||||
curl http://127.0.0.1:8645/debug/v1/info
|
||||
curl --location 'http://127.0.0.1:8645/debug/v1/info'
|
||||
```
|
||||
|
||||
Send a message to a `contentTopic`, which all subscribers will receive. Please note that the payload is encoded in `base64`.
|
||||
|
||||
```shell
|
||||
curl -X POST "http://127.0.0.1:8645/relay/v1/auto/messages" \
|
||||
-H "content-type: application/json" \
|
||||
-d '{"payload":"'$(echo -n "Hello Waku Network - from Anonymous User" | base64)'","contentTopic":"/my-app/2/chatroom-1/proto"}'
|
||||
curl --location 'http://127.0.0.1:8645/relay/v1/auto/messages' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data '{
|
||||
"payload": "'$(echo -n "Hello Waku Network - from Anonymous User" | base64)'",
|
||||
"contentTopic": "/my-app/2/chatroom-1/proto"
|
||||
}'
|
||||
```
|
||||
|
||||
Retrieve messages sent to a `contentTopic`. Please note that this query can be made to any `Store` node within the network:
|
||||
|
||||
```shell
|
||||
curl -X GET "http://127.0.0.1:8645/store/v1/messages?contentTopics=%2Fmy-app%2F2%2Fchatroom-1%2Fproto&pageSize=50&ascending=true" \
|
||||
-H "accept: application/json"
|
||||
curl --location 'http://127.0.0.1:8645/store/v1/messages?contentTopics=%2Fmy-app%2F2%2Fchatroom-1%2Fproto&pageSize=50&ascending=true' \
|
||||
--header 'Accept: application/json'
|
||||
```
|
||||
|
||||
:::tip Congratulations!
|
||||
|
||||
@ -69,7 +69,7 @@ You can configure a `nwaku` node to use multiple peer discovery mechanisms simul
|
||||
|
||||
## Interact with the Node
|
||||
|
||||
You can interact with a running `nwaku` node through the [JSON RPC API](https://rfc.vac.dev/spec/16/), such as querying the node information using the `get_waku_v2_debug_v1_info` method:
|
||||
You can interact with a running `nwaku` node through the [REST API](https://waku-org.github.io/waku-rest-api/), such as querying the node information using the [Get node info](https://waku-org.github.io/waku-rest-api/#get-/debug/v1/info) endpoint:
|
||||
|
||||
```mdx-code-block
|
||||
import Tabs from '@theme/Tabs';
|
||||
@ -80,14 +80,8 @@ import TabItem from '@theme/TabItem';
|
||||
<TabItem value="request" label="Request">
|
||||
|
||||
```bash
|
||||
curl --location --request GET 'http://localhost:8545' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data '{
|
||||
"jsonrpc": "2.0",
|
||||
"id": "id",
|
||||
"method": "get_waku_v2_debug_v1_info",
|
||||
"params": []
|
||||
}'
|
||||
curl --location 'http://127.0.0.1:8645/debug/v1/info' \
|
||||
--header 'Accept: application/json'
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
@ -95,14 +89,10 @@ curl --location --request GET 'http://localhost:8545' \
|
||||
|
||||
```json
|
||||
{
|
||||
"jsonrpc": "2.0",
|
||||
"id": "id",
|
||||
"result": {
|
||||
"listenAddresses": [
|
||||
"/ip4/0.0.0.0/tcp/60000/p2p/16Uiu2HAmUbPquFQqje3jiqoB5YoiUbBya59NB4qqEzeiTNGHeA6w"
|
||||
],
|
||||
"enrUri": "enr:-Iu4QCQZXZDb_JsYmLoYor0F5E_95HbIywgO_wgx2rIdDbmCJZkTzmlCr0wmMzV47lgik_tVwww5mIng90Ris83TisMBgmlkgnY0gmlwhAAAAACJc2VjcDI1NmsxoQPszztG-Ev52ZB7tk0jF8s6Md4KvyY_rhzNZokaaB_ABIN0Y3CC6mCFd2FrdTIB"
|
||||
}
|
||||
"listenAddresses": [
|
||||
"/ip4/0.0.0.0/tcp/60000/p2p/16Uiu2HAmUbPquFQqje3jiqoB5YoiUbBya59NB4qqEzeiTNGHeA6w"
|
||||
],
|
||||
"enrUri": "enr:-Iu4QCQZXZDb_JsYmLoYor0F5E_95HbIywgO_wgx2rIdDbmCJZkTzmlCr0wmMzV47lgik_tVwww5mIng90Ris83TisMBgmlkgnY0gmlwhAAAAACJc2VjcDI1NmsxoQPszztG-Ev52ZB7tk0jF8s6Md4KvyY_rhzNZokaaB_ABIN0Y3CC6mCFd2FrdTIB"
|
||||
}
|
||||
```
|
||||
|
||||
@ -115,7 +105,7 @@ The `listenAddresses` field stores the node's listening addresses, while the `en
|
||||
|
||||
## Find the Node Addresses
|
||||
|
||||
You can find the addresses of a running node through its logs or by calling the `get_waku_v2_debug_v1_info` method of the [JSON RPC API](https://rfc.vac.dev/spec/16/).
|
||||
You can find the addresses of a running node through its logs or by calling the [Get node info](https://waku-org.github.io/waku-rest-api/#get-/debug/v1/info) endpoint of the [REST API](https://waku-org.github.io/waku-rest-api/).
|
||||
|
||||
:::info
|
||||
When starting the node, `nwaku` will display all the public listening and discovery addresses at the `INFO` log level.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user