mirror of
https://github.com/oceanprotocol/docs.git
synced 2024-11-26 19:49:26 +01:00
GITBOOK-150: change request with no subject merged in GitBook
This commit is contained in:
parent
12644f77c0
commit
b1e54376bf
@ -30,7 +30,7 @@ Copy the query in the [GraphiQL interface](https://v4.subgraph.mainnet.oceanprot
|
|||||||
{% tab title="Python" %}
|
{% tab title="Python" %}
|
||||||
The python script below can be used to run the the query. If you wish to change the network, then replace the value of variable `base_url` as needed.
|
The python script below can be used to run the the query. If you wish to change the network, then replace the value of variable `base_url` as needed.
|
||||||
|
|
||||||
#### Create script
|
**Create script**
|
||||||
|
|
||||||
{% code title="list_dataNFTs.py" %}
|
{% code title="list_dataNFTs.py" %}
|
||||||
```python
|
```python
|
||||||
@ -76,13 +76,10 @@ python list_dataNFTs.py
|
|||||||
{% endtab %}
|
{% endtab %}
|
||||||
|
|
||||||
{% tab title="Javascript" %}
|
{% tab title="Javascript" %}
|
||||||
The javascript below can be used to run the the query. If you wish to change the network, then replace the value of variable `baseUrl` as needed.
|
The javascript below can be used to run the query. If you wish to change the network, then replace the value of `network` as needed.
|
||||||
|
|
||||||
#### Create script
|
```runkit nodeVersion="18.x.x"
|
||||||
|
const axios = require('axios')
|
||||||
{% code title="listDatatoken.js" %}
|
|
||||||
```javascript
|
|
||||||
var axios = require('axios');
|
|
||||||
|
|
||||||
const query = `{
|
const query = `{
|
||||||
nfts (skip:0, first: 10, subgraphError:deny){
|
nfts (skip:0, first: 10, subgraphError:deny){
|
||||||
@ -98,32 +95,17 @@ const query = `{
|
|||||||
}
|
}
|
||||||
}`
|
}`
|
||||||
|
|
||||||
const baseUrl = "https://v4.subgraph.mainnet.oceanprotocol.com"
|
const network = "mainnet"
|
||||||
const route = "/subgraphs/name/oceanprotocol/ocean-subgraph"
|
const config = {
|
||||||
|
|
||||||
const url = `${baseUrl}${route}`
|
|
||||||
|
|
||||||
var config = {
|
|
||||||
method: 'post',
|
method: 'post',
|
||||||
url: url,
|
url: `https://v4.subgraph.${network}.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph`,
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
data: JSON.stringify({ "query": query })
|
data: JSON.stringify({ query: query })
|
||||||
};
|
}
|
||||||
|
|
||||||
axios(config)
|
const response = await axios(config)
|
||||||
.then(function (response) {
|
console.log('Response', response)
|
||||||
console.log(JSON.stringify(response.data));
|
|
||||||
})
|
|
||||||
.catch(function (error) {
|
|
||||||
console.log(error);
|
|
||||||
});
|
|
||||||
```
|
|
||||||
{% endcode %}
|
|
||||||
|
|
||||||
#### Execute script
|
|
||||||
|
|
||||||
```bash
|
|
||||||
node listDatatoken.js
|
|
||||||
```
|
```
|
||||||
{% endtab %}
|
{% endtab %}
|
||||||
{% endtabs %}
|
{% endtabs %}
|
||||||
|
Loading…
Reference in New Issue
Block a user