Get all planets
It’s easy to say you know them all, but do you really? Retrieve all the planets and check whether you missed one.
Query Parameters
limit?integer
The number of items to return
Default
10
Format
int64
offset?integer
The number of items to skip before starting to collect the result set
Format
int64
Response Body
curl -X GET "https://galaxy.scalar.com/planets?limit=10"
fetch("https://galaxy.scalar.com/planets?limit=10")
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://galaxy.scalar.com/planets?limit=10"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
import requests
url = "https://galaxy.scalar.com/planets?limit=10"
response = requests.request("GET", url)
print(response.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.http.HttpResponse.BodyHandlers;
import java.time.Duration;
HttpClient client = HttpClient.newBuilder()
.connectTimeout(Duration.ofSeconds(10))
.build();
HttpRequest.Builder requestBuilder = HttpRequest.newBuilder()
.uri(URI.create("https://galaxy.scalar.com/planets?limit=10"))
.GET()
.build();
try {
HttpResponse<String> response = client.send(requestBuilder.build(), BodyHandlers.ofString());
System.out.println("Status code: " + response.statusCode());
System.out.println("Response body: " + response.body());
} catch (Exception e) {
e.printStackTrace();
}
using System;
using System.Net.Http;
using System.Text;
var client = new HttpClient();
var response = await client.GetAsync("https://galaxy.scalar.com/planets?limit=10");
var responseBody = await response.Content.ReadAsStringAsync();
{
"data": [
{
"id": 1,
"name": "Mars",
"description": "The red planet",
"type": "terrestrial",
"habitabilityIndex": 0.68,
"physicalProperties": {
"mass": 0.107,
"radius": 0.532,
"gravity": 0.378,
"temperature": {
"min": 130,
"max": 308,
"average": 210
}
},
"atmosphere": [
{
"compound": "CO2",
"percentage": 95.3
}
],
"discoveredAt": "1610-01-07T00:00:00Z",
"image": "https://cdn.scalar.com/photos/mars.jpg",
"satellites": [
{
"name": "Phobos",
"diameter": 22.2
}
],
"creator": {
"id": 1,
"name": "Marc"
},
"tags": [
"solar-system",
"rocky",
"explored"
],
"lastUpdated": "2024-01-15T14:30:00Z",
"successCallbackUrl": "https://example.com/webhook",
"failureCallbackUrl": "https://example.com/webhook"
}
],
"meta": {
"limit": 10,
"offset": 0,
"total": 100,
"next": "/planets?limit=10&offset=10"
}
}
How is this guide?