mirror of
https://github.com/oceanprotocol/docs.git
synced 2024-11-01 07:45:40 +01:00
GITBOOK-215: Adding runkit examples to provider page
This commit is contained in:
parent
9f8c822417
commit
4d547a28d4
@ -1,4 +1,4 @@
|
||||
# Provider REST API
|
||||
# Provider
|
||||
|
||||
[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:
|
||||
|
||||
```
|
||||
POST /api/services/nonce?userAddress=0x990922334
|
||||
GET /api/services/nonce?userAddress=0x990922334
|
||||
```
|
||||
|
||||
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
|
||||
|
||||
#### GET /api/services/encrypt
|
||||
@ -57,6 +69,21 @@ Response:
|
||||
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
|
||||
|
||||
#### POST /api/services/decrypt
|
||||
|
Loading…
Reference in New Issue
Block a user