1
0
mirror of https://github.com/oceanprotocol/docs.git synced 2024-11-26 19:49:26 +01:00

GITBOOK-215: Adding runkit examples to provider page

This commit is contained in:
Jamie Hewitt 2023-05-22 14:29:16 +00:00 committed by gitbook-bot
parent 9f8c822417
commit 4d547a28d4
No known key found for this signature in database
GPG Key ID: 07D2180C7B12D0FF

View File

@ -1,4 +1,4 @@
# Provider REST API # Provider
[https://v4.provider.oceanprotocol.com](https://v4.provider.oceanprotocol.com) [https://v4.provider.oceanprotocol.com](https://v4.provider.oceanprotocol.com)
@ -25,7 +25,7 @@ Returns: Json object containing the last-used nonce value. The nonce endpoint is
Example: Example:
``` ```
POST /api/services/nonce?userAddress=0x990922334 GET /api/services/nonce?userAddress=0x990922334
``` ```
Response: Response:
@ -36,6 +36,18 @@ Response:
} }
``` ```
#### Javascript Example
```runkit nodeVersion="18.x.x"
const axios = require('axios')
const response = await axios( `https://v4.provider.oceanprotocol.com/api/services/nonce?userAddress=0x0db823218e337a6817e6d7740eb17635deadafaf`)
console.log(response.status)
console.log(response.data)
```
### Encrypt endpoint ### Encrypt endpoint
#### GET /api/services/encrypt #### GET /api/services/encrypt
@ -57,6 +69,21 @@ Response:
b'0x04b2bfab1f4e...7ed0573' b'0x04b2bfab1f4e...7ed0573'
``` ```
#### Javascript Example
```runkit nodeVersion="18.x.x"
const fetch = require('cross-fetch')
const data = "test"
const response = await fetch('https://v4.provider.oceanprotocol.com/api/services/encrypt?chainId=1', {
method: 'POST',
body: JSON.stringify(data),
headers: { 'Content-Type': 'application/octet-stream' }
})
console.log(response)
```
### Decrypt endpoint ### Decrypt endpoint
#### POST /api/services/decrypt #### POST /api/services/decrypt