> ## Documentation Index
> Fetch the complete documentation index at: https://www.diadata.org/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Request Samples

> You can find examples of how to query the endpoint in different programming languages below:

<AccordionGroup>
  <Accordion title="Python">
    ```python theme={"system"}
    import requests
    import json

    url = "https://api.diadata.org/graphql/query"

    query = """
    {
    GetFeed(
          Filter: "mair",
          BlockSizeSeconds: 480,
          BlockShiftSeconds: 480,
          StartTime: 1690449575,
          EndTime: 1690535975,
          FeedSelection: [
            {
              Address: "0x6B175474E89094C44Da98b954EedeAC495271d0F",
              Blockchain:"Ethereum",
              Exchangepairs:[],
            },
          ],
        )
      {
        Name
        Time
        Value
        Pools
        Pairs
      }
    }
    """

    headers = {
        "Content-Type": "application/json"
    }

    data = {
        "query": query
    }

    response = requests.post(url, headers=headers, data=json.dumps(data))

    if response.status_code == 200:
        # Print the response content
        print(response.json())
    else:
        print("Request failed with status code:", response.status_code)
    ```
  </Accordion>

  <Accordion title="GO">
    ```go theme={"system"}
    package main

    import (
    	"bytes"
    	"encoding/json"
    	"fmt"
    	"net/http"
    )

    func main() {
    	url := "https://api.diadata.org/graphql/query"

    	query := `
    		GetFeed(
          			Filter: "mair",
          			BlockSizeSeconds: 480,
          			BlockShiftSeconds: 480,
          			StartTime: 1690449575,
          			EndTime: 1690535975,
          			FeedSelection: [
            		{
              		Address: "0x6B175474E89094C44Da98b954EedeAC495271d0F",
              		Blockchain:"Ethereum",
              		Exchangepairs:[],
            		},
          		],
        	)
      			{
       			Name
       			Time
        			Value
        			Pools
        			Pairs
      			}
    		}
    	`
    	requestBody, err := json.Marshal(map[string]string{
    		"query": query,
    	})
    	if err != nil {
    		fmt.Println("Failed to create request body:", err)
    		return
    	}

    	response, err := http.Post(url, "application/json", bytes.NewBuffer(requestBody))
    	if err != nil {
    		fmt.Println("Request failed:", err)
    		return
    	}
    	defer response.Body.Close()

    	if response.StatusCode == http.StatusOK {
    		var data map[string]interface{}
    		err = json.NewDecoder(response.Body).Decode(&data)
    		if err != nil {
    			fmt.Println("Failed to decode response JSON:", err)
    			return
    		}

    		fmt.Println(data)
    	} else {
    		fmt.Println("Request failed with status code:", response.StatusCode)
    	}
    }
    ```
  </Accordion>

  <Accordion title="JavaScript">
    ```javascript theme={"system"}
    const axios = require('axios');

    const url = 'https://api.diadata.org/graphql/query';

    const query = `
      {
        GetFeed(
          Filter: "mair",
          BlockSizeSeconds: 480,
          BlockShiftSeconds: 480,
          StartTime: 1690449575,
          EndTime: 1690535975,
          FeedSelection: [
            {
              Address: "0x6B175474E89094C44Da98b954EedeAC495271d0F",
              Blockchain:"Ethereum",
              Exchangepairs:[],
            },
          ],
        )
      {
        Name
        Time
        Value
        Pools
        Pairs
      }
    }  }
    `;

    const data = {
      query: query
    };

    axios.post(url, data)
      .then(response => {
        console.log(response.data);
      })
      .catch(error => {
        console.error('Request failed:', error.message);
      });
    ```
  </Accordion>

  <Accordion title="Node">
    ```javascript theme={"system"}
    const fetch = require('node-fetch');

    const url = 'https://api.diadata.org/graphql/query';

    const query = `
      {
    GetFeed(
          Filter: "mair",
          BlockSizeSeconds: 480,
          BlockShiftSeconds: 480,
          StartTime: 1690449575,
          EndTime: 1690535975,
          FeedSelection: [
            {
              Address: "0x6B175474E89094C44Da98b954EedeAC495271d0F",
              Blockchain:"Ethereum",
              Exchangepairs:[],
            },
          ],
        )
      {
        Name
        Time
        Value
        Pools
        Pairs
      }
    }
    `;

    const data = JSON.stringify({ query });

    fetch(url, {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: data
    })
      .then(response => response.json())
      .then(data => {
        console.log(data);
      })
      .catch(error => {
        console.error('Request failed:', error);
      });
    ```
  </Accordion>

  <Accordion title="Rust">
    ```rust theme={"system"}
    use reqwest;
    use serde_json::json;

    #[tokio::main]
    async fn main() -> Result<(), Box<dyn std::error::Error>> {
        let url = "https://api.diadata.org/graphql/query";

        let query = r#"
            {
                {
    GetFeed(
          Filter: "mair",
          BlockSizeSeconds: 480,
          BlockShiftSeconds: 480,
          StartTime: 1690449575,
          EndTime: 1690535975,
          FeedSelection: [
            {
              Address: "0x6B175474E89094C44Da98b954EedeAC495271d0F",
              Blockchain:"Ethereum",
              Exchangepairs:[],
            },
          ],
        )
      {
        Name
        Time
        Value
        Pools
        Pairs
      }
    }
        "#;

        let data = json!({
            "query": query,
        });

        let client = reqwest::Client::new();
        let response = client
            .post(url)
            .json(&data)
            .send()
            .await?;

        if response.status().is_success() {
            let body = response.text().await?;
            println!("{}", body);
        } else {
            println!("Request failed with status code: {}", response.status());
        }

        Ok(())
    }
    ```
  </Accordion>

  <Accordion title="PHP">
    ```php theme={"system"}
    <?php

    $url = 'https://api.diadata.org/graphql/query';

    $query = '
      {
    GetFeed(
          Filter: "mair",
          BlockSizeSeconds: 480,
          BlockShiftSeconds: 480,
          StartTime: 1690449575,
          EndTime: 1690535975,
          FeedSelection: [
            {
              Address: "0x6B175474E89094C44Da98b954EedeAC495271d0F",
              Blockchain:"Ethereum",
              Exchangepairs:[],
            },
          ],
        )
      {
        Name
        Time
        Value
        Pools
        Pairs
      }
    }
    ';

    $data = array(
        'query' => $query
    );

    $options = array(
        CURLOPT_URL => $url,
        CURLOPT_POST => true,
        CURLOPT_POSTFIELDS => json_encode($data),
        CURLOPT_HTTPHEADER => array(
            'Content-Type: application/json'
        ),
        CURLOPT_RETURNTRANSFER => true
    );

    $ch = curl_init();

    curl_setopt_array($ch, $options);

    $response = curl_exec($ch);

    if (curl_errno($ch)) {
        echo 'Request failed with error: ' . curl_error($ch);
    } else {
        echo $response;
    }

    curl_close($ch);
    ?>
    ```
  </Accordion>
</AccordionGroup>
