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

GITBOOK-209: Adding additional Runkit examples

This commit is contained in:
Jamie Hewitt 2023-05-22 12:59:47 +00:00 committed by gitbook-bot
parent 8e093fae9f
commit db674d1797
No known key found for this signature in database
GPG Key ID: 07D2180C7B12D0FF

View File

@ -115,7 +115,7 @@ Get names of assets as specified in the payload.
| --------- | ------------------ | ---- | ---- | -------- |
| `didList` | list of asset DIDs | list | body | true |
#### Example
#### Curl Example
```bash
curl --location --request POST 'https://v4.aquarius.oceanprotocol.com/api/aquarius/assets/names' \
@ -125,6 +125,21 @@ curl --location --request POST 'https://v4.aquarius.oceanprotocol.com/api/aquari
}'
```
#### Javascript Example
```runkit nodeVersion="18.x.x"
const axios = require('axios')
const body = {didList : ["did:op:cd086344c275bc7c560e91d472be069a24921e73a2c3798fb2b8caadf8d245d6", "did:op:ce3f161fb98c64a2ded37fd34e25f28343f2c88d0c8205242df9c621770d4b3b"]}
const response = await axios.post('https://v4.aquarius.oceanprotocol.com/api/aquarius/assets/names', body)
console.log(response.status)
for (let key in response.data) {
console.log(key + ': ' + response.data[key]);
}
```
#### Responses
`200`
@ -155,7 +170,7 @@ curl --location --request POST 'https://v4.aquarius.oceanprotocol.com/api/aquari
Run a native ES query. Body must be a valid json object.
#### Example
#### Curl Example
```bash
curl --location --request POST 'https://v4.aquarius.oceanprotocol.com/api/aquarius/assets/query' \
@ -167,6 +182,23 @@ curl --location --request POST 'https://v4.aquarius.oceanprotocol.com/api/aquari
}'
```
#### Javascript Example
```runkit nodeVersion="18.x.x"
const axios = require('axios')
const body = { "query": { "match_all": { } } }
const response = await axios.post('https://v4.aquarius.oceanprotocol.com/api/aquarius/assets/query', body)
console.log(response.status)
console.log(response.data.hits.hits[0])
for (const value of response.data.hits.hits) {
console.log(value);
}
```
#### Responses
`200`
@ -248,23 +280,26 @@ Error
### **POST** `/api/aquarius/assets/triggerCaching`
* Description
#### Description
Manually triggers DDO caching based on a transacionId containing either MetadataCreated or MetadataUpdated event(s).
* Parameters
Manually triggers DDO caching based on a `transacionId` containing either MetadataCreated or MetadataUpdated event(s).
#### Parameters
| name | description | type | in | required |
| --------------- | ------------------------------------ | ------ | ---- | -------- |
| `transactionId` | DID of the asset | string | path | true |
| `logIndex` | custom log index for the transaction | int | path | false |
* Example
#### Curl Example
```bash
curl --location --request POST 'https://v4.aquarius.oceanprotocol.com/api/aquarius/assets/triggerCaching' \
--header 'Content-Type: application/json' \
--data-raw '<json_body>'
```
* Valid body
#### Valid body
```
{
@ -272,30 +307,46 @@ Error
"logIndex": 0
}
```
* Responses:
* 200
* description: triggering successful, updated asset returned
* 400
* description: request issues: either log index not found, or neither of MetadataCreated, MetadataUpdated found in tx log
* 500
* description: Error
#### Responses:
`200`
Description: triggering successful, updated asset returned
`400`
Description: request issues: either log index not found, or neither of MetadataCreated, MetadataUpdated found in tx log
`500`
Description: Error
## Chains
### **GET** `/api/aquarius/chains/list`
* Description
#### Description
Get chains list
* Example
#### Curl Example
```bash
curl --location --request GET 'https://v4.aquarius.oceanprotocol.com/api/aquarius/chains/list'
```
* Response
* 200
* Description: Successful request
* Body
#### Javascript Example
{% embed url="https://runkit.com/oceanprotocol/646b66cc929a68000864e76e" %}
#### Response
`200`
Description: Successful request
Body:
```
{ "246": true, "3": true, "137": true,
@ -306,18 +357,23 @@ Error
### **GET** `/api/aquarius/chains/status/{chain_id}`
* Description
#### Description
Get index status for a specific chain\_id
* Example
#### Curl Example
```bash
curl --location --request GET 'https://v4.aquarius.oceanprotocol.com/api/aquarius/chains/status/137'
```
* Response
* 200
* Description: Successful request
* Body
#### Response
`200`
Description: Successful request
Body:
```
{"last_block": 25198729}
@ -327,18 +383,34 @@ Error
### **GET** `/`
* Description
#### Description
Get version, plugin, and software information.
* Example
#### Curl Example
```bash
curl --location --request GET 'https://v4.aquarius.oceanprotocol.com/'
```
* Response
* 200
* Description: Successful request
* Body
#### Javascript Example
```runkit nodeVersion="18.x.x"
const axios = require('axios')
const response = await axios( 'https://v4.aquarius.oceanprotocol.com/')
console.log(response.status)
console.log(response.data)
```
#### Response
`200`
Description: Successful request
Body:
```
{
@ -350,18 +422,34 @@ Error
### **GET** `/health`
* Description
**Description**
Get health status
* Example
**Curl Example**
```bash
curl --location --request GET 'https://v4.aquarius.oceanprotocol.com/health'
```
* Response
* 200
* Description: Successful request
* Body
#### Javascript Example
```runkit nodeVersion="18.x.x"
const axios = require('axios')
const response = await axios( 'https://v4.aquarius.oceanprotocol.com/health')
console.log(response.status)
console.log(response.data)
```
**Response**
`200`
Description: Successful request
Body:
```
Elasticsearch connected
@ -379,6 +467,17 @@ Get swagger spec
curl --location --request GET 'https://v4.aquarius.oceanprotocol.com/spec'
```
#### Javascript Example
```runkit nodeVersion="18.x.x"
const axios = require('axios')
const response = await axios( 'https://v4.aquarius.oceanprotocol.com/spec')
console.log(response.status)
console.log(response.data.info)
```
#### Response
`200`