Explore the power of Go with our Air Quality API. This code sample demonstrates how to interact with our endpoints using Go, providing a seamless integration experience for your applications.
// Import necessary packages
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
// Define API endpoint
apiEndpoint := "https://api.airqo.net/v2/your-endpoint-path"
// Make a GET request to the API
resp, err := http.Get(apiEndpoint)
if err != nil {
fmt.Println("Error:", err)
return
}
defer resp.Body.Close()
// Read the response body
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println("Error reading response:", err)
return
}
// Display the API response
fmt.Println("API Response:", string(body))
}
Leverage Dart's simplicity and efficiency with our Air Quality API. This code sample showcases how to utilize Dart for seamless integration with our API, offering a smooth development experience for your projects.
import 'dart:convert';
import 'package:http/http.dart' as http;
void main() async {
// Define API endpoint
var apiEndpoint = 'https://api.airqo.net/v2/your-endpoint-path';
// Make a GET request to the API
var response = await http.get(Uri.parse(apiEndpoint));
// Decode and display the API response
var jsonResponse = json.decode(response.body);
print('API Response: $jsonResponse');
}