Skip to content
v1.0.0

Scalar Galaxy

The Scalar Galaxy is an example OpenAPI specification to test OpenAPI tools and libraries. It’s a fictional universe with fictional planets and fictional data. Get all the data for all planets.

Resources

  • https://github.com/scalar/scalar
  • https://github.com/OAI/OpenAPI-Specification
  • https://scalar.com

Markdown Support

All descriptions can contain tons of text Markdown. If GitHub supports the syntax, chances are we’re supporting it, too. You can even create internal links to reference endpoints.

Examples

Blockquotes

I love OpenAPI. <3

Tables

Feature Availability
Markdown Support

Accordion

<details>
  <summary>Using Details Tags</summary>
  <p>HTML Example</p>
</details>

Images

Yes, there’s support for images, too!

Empty placeholder image showing the width/height

Contact

Servers

https://galaxy.scalar.com
{protocol}://void.scalar.com/{path}Responds with your request data

Planets


ID: getAllData

Get all planets

GET
/planets
Server

It’s easy to say you know them all, but do you really? Retrieve all the planets and check whether you missed one.

Parameters

Query Parameters

limit

The number of items to return

Typeinteger
formatint64
default10
offset

The number of items to skip before starting to collect the result set

Typeinteger
formatint64
default0

Responses

OK
application/json
JSON
{
"data": [
{
"id": 1,
"name": "Mars",
"description": "The red planet",
"image": "https://cdn.scalar.com/photos/mars.jpg",
"creator": {
"id": 1,
"name": "Marc",
"email": "marc@scalar.com",
"password": "i-love-scalar"
}
}
],
"meta": {
"limit": 10,
"offset": 0,
"total": 100,
"next": "/planets?limit=10&offset=10"
}
}

Samples

Bruno
get {
  url: https://galaxy.scalar.com/planets
}

headers {
  Content-Type: application/json
}
Bruno
get {
  url: https://galaxy.scalar.com/planets
}

headers {
  Content-Type: application/json
}
cURL
curl -X GET \
'https://galaxy.scalar.com/planets' \
 -H "Content-Type: application/json"
JavaScript
fetch('https://galaxy.scalar.com/planets', {headers:{'Content-Type':'application/json'}})
  .then(response => response.json())
  .then(data => console.log(data));
PHP
<?php
$url = 'https://galaxy.scalar.com/planets';
$method = 'GET';
$headers = [
    'Content-Type' => 'application/json',
];

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$response = curl_exec($ch);
curl_close($ch);

echo $response;
?>
Python
import requests

url = 'https://galaxy.scalar.com/planets'

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

response = requests.get(url, headers=headers)
print(response.json())

ID: createPlanet

Create a planet

POST
/planets
Server

Time to play god and create a new planet. What do you think? Ah, don’t think too much. What could go wrong anyway?

Authorizations

bearerAuth

JWT Bearer token authentication

TypeHTTP (bearer)
or
basicAuth

Basic HTTP authentication

TypeHTTP (basic)
or
apiKeyQuery

API key query parameter

TypeAPI Key (query: api_key)
or
apiKeyHeader

API key request header

TypeAPI Key (header: X-API-Key)
or
apiKeyCookie

API key browser cookie

TypeAPI Key (cookie: api_key)
or
oAuth2

OAuth 2.0 authentication

authorizationCode Flow:
Authorization URL: https://galaxy.scalar.com/oauth/authorizeToken URL: https://galaxy.scalar.com/oauth/token
Scopes:
  • read:account: read your account information
  • write:planets: modify planets in your account
  • read:planets: read your planets
clientCredentials Flow:
Authorization URL: Token URL: https://galaxy.scalar.com/oauth/token
Scopes:
  • read:account: read your account information
  • write:planets: modify planets in your account
  • read:planets: read your planets
implicit Flow:
Authorization URL: https://galaxy.scalar.com/oauth/authorizeToken URL:
Scopes:
  • read:account: read your account information
  • write:planets: modify planets in your account
  • read:planets: read your planets
password Flow:
Authorization URL: Token URL: https://galaxy.scalar.com/oauth/token
Scopes:
  • read:account: read your account information
  • write:planets: modify planets in your account
  • read:planets: read your planets

Request Body

JSON
{
"id": 1,
"name": "Mars",
"description": "The red planet",
"image": "https://cdn.scalar.com/photos/mars.jpg",
"creator": {
"id": 1,
"name": "Marc",
"email": "marc@scalar.com",
"password": "i-love-scalar"
}
}

Responses

Created
application/json
JSON
{
"id": 1,
"name": "Mars",
"description": "The red planet",
"image": "https://cdn.scalar.com/photos/mars.jpg",
"creator": {
"id": 1,
"name": "Marc",
"email": "marc@scalar.com",
"password": "i-love-scalar"
}
}

Samples

Bruno
post {
  url: https://galaxy.scalar.com/planets
}

headers {
  Content-Type: application/json
}
Bruno
post {
  url: https://galaxy.scalar.com/planets
}

headers {
  Content-Type: application/json
}
cURL
curl -X POST \
'https://galaxy.scalar.com/planets' \
 -H "Content-Type: application/json"
JavaScript
fetch('https://galaxy.scalar.com/planets', {method:'POST',headers:{'Content-Type':'application/json'}})
  .then(response => response.json())
  .then(data => console.log(data));
PHP
<?php
$url = 'https://galaxy.scalar.com/planets';
$method = 'POST';
$headers = [
    'Content-Type' => 'application/json',
];

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$response = curl_exec($ch);
curl_close($ch);

echo $response;
?>
Python
import requests

url = 'https://galaxy.scalar.com/planets'

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

response = requests.post(url, headers=headers)
print(response.json())

ID: getPlanet

Get a planet

GET
/planets/{planetId}
Server

You’ll better learn a little bit more about the planets. It might come in handy once space travel is available for everyone.

Parameters

Path Parameters

planetId*
Typeinteger
Required
Example1
formatint64

Responses

Planet Found
application/json
JSON
{
"id": 1,
"name": "Mars",
"description": "The red planet",
"image": "https://cdn.scalar.com/photos/mars.jpg",
"creator": {
"id": 1,
"name": "Marc",
"email": "marc@scalar.com",
"password": "i-love-scalar"
}
}

Samples

Bruno
get {
  url: https://galaxy.scalar.com/planets/1
}

headers {
  Content-Type: application/json
}
Bruno
get {
  url: https://galaxy.scalar.com/planets/1
}

headers {
  Content-Type: application/json
}
cURL
curl -X GET \
'https://galaxy.scalar.com/planets/1' \
 -H "Content-Type: application/json"
JavaScript
fetch('https://galaxy.scalar.com/planets/1', {headers:{'Content-Type':'application/json'}})
  .then(response => response.json())
  .then(data => console.log(data));
PHP
<?php
$url = 'https://galaxy.scalar.com/planets/1';
$method = 'GET';
$headers = [
    'Content-Type' => 'application/json',
];

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$response = curl_exec($ch);
curl_close($ch);

echo $response;
?>
Python
import requests

url = 'https://galaxy.scalar.com/planets/1'

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

response = requests.get(url, headers=headers)
print(response.json())

ID: updatePlanet

Update a planet

PUT
/planets/{planetId}
Server

Sometimes you make mistakes, that’s fine. No worries, you can update all planets.

Authorizations

bearerAuth

JWT Bearer token authentication

TypeHTTP (bearer)
or
basicAuth

Basic HTTP authentication

TypeHTTP (basic)
or
apiKeyQuery

API key query parameter

TypeAPI Key (query: api_key)
or
apiKeyHeader

API key request header

TypeAPI Key (header: X-API-Key)
or
apiKeyCookie

API key browser cookie

TypeAPI Key (cookie: api_key)
or
oAuth2

OAuth 2.0 authentication

authorizationCode Flow:
Authorization URL: https://galaxy.scalar.com/oauth/authorizeToken URL: https://galaxy.scalar.com/oauth/token
Scopes:
  • read:account: read your account information
  • write:planets: modify planets in your account
  • read:planets: read your planets
clientCredentials Flow:
Authorization URL: Token URL: https://galaxy.scalar.com/oauth/token
Scopes:
  • read:account: read your account information
  • write:planets: modify planets in your account
  • read:planets: read your planets
implicit Flow:
Authorization URL: https://galaxy.scalar.com/oauth/authorizeToken URL:
Scopes:
  • read:account: read your account information
  • write:planets: modify planets in your account
  • read:planets: read your planets
password Flow:
Authorization URL: Token URL: https://galaxy.scalar.com/oauth/token
Scopes:
  • read:account: read your account information
  • write:planets: modify planets in your account
  • read:planets: read your planets

Parameters

Path Parameters

planetId*
Typeinteger
Required
Example1
formatint64

Request Body

JSON
{
"id": 1,
"name": "Mars",
"description": "The red planet",
"image": "https://cdn.scalar.com/photos/mars.jpg",
"creator": {
"id": 1,
"name": "Marc",
"email": "marc@scalar.com",
"password": "i-love-scalar"
}
}

Responses

OK
application/json
JSON
{
"id": 1,
"name": "Mars",
"description": "The red planet",
"image": "https://cdn.scalar.com/photos/mars.jpg",
"creator": {
"id": 1,
"name": "Marc",
"email": "marc@scalar.com",
"password": "i-love-scalar"
}
}

Samples

Bruno
put {
  url: https://galaxy.scalar.com/planets/1
}

headers {
  Content-Type: application/json
}
Bruno
put {
  url: https://galaxy.scalar.com/planets/1
}

headers {
  Content-Type: application/json
}
cURL
curl -X PUT \
'https://galaxy.scalar.com/planets/1' \
 -H "Content-Type: application/json"
JavaScript
fetch('https://galaxy.scalar.com/planets/1', {method:'PUT',headers:{'Content-Type':'application/json'}})
  .then(response => response.json())
  .then(data => console.log(data));
PHP
<?php
$url = 'https://galaxy.scalar.com/planets/1';
$method = 'PUT';
$headers = [
    'Content-Type' => 'application/json',
];

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$response = curl_exec($ch);
curl_close($ch);

echo $response;
?>
Python
import requests

url = 'https://galaxy.scalar.com/planets/1'

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

response = requests.put(url, headers=headers)
print(response.json())

ID: deletePlanet

Delete a planet

DELETE
/planets/{planetId}
Server

This endpoint was used to delete planets. Unfortunately, that caused a lot of trouble for planets with life. So, this endpoint is now deprecated and should not be used anymore.

Authorizations

bearerAuth

JWT Bearer token authentication

TypeHTTP (bearer)
or
basicAuth

Basic HTTP authentication

TypeHTTP (basic)
or
apiKeyQuery

API key query parameter

TypeAPI Key (query: api_key)
or
apiKeyHeader

API key request header

TypeAPI Key (header: X-API-Key)
or
apiKeyCookie

API key browser cookie

TypeAPI Key (cookie: api_key)
or
oAuth2

OAuth 2.0 authentication

authorizationCode Flow:
Authorization URL: https://galaxy.scalar.com/oauth/authorizeToken URL: https://galaxy.scalar.com/oauth/token
Scopes:
  • read:account: read your account information
  • write:planets: modify planets in your account
  • read:planets: read your planets
clientCredentials Flow:
Authorization URL: Token URL: https://galaxy.scalar.com/oauth/token
Scopes:
  • read:account: read your account information
  • write:planets: modify planets in your account
  • read:planets: read your planets
implicit Flow:
Authorization URL: https://galaxy.scalar.com/oauth/authorizeToken URL:
Scopes:
  • read:account: read your account information
  • write:planets: modify planets in your account
  • read:planets: read your planets
password Flow:
Authorization URL: Token URL: https://galaxy.scalar.com/oauth/token
Scopes:
  • read:account: read your account information
  • write:planets: modify planets in your account
  • read:planets: read your planets

Parameters

Path Parameters

planetId*
Typeinteger
Required
Example1
formatint64

Responses

No Content

Samples

Bruno
delete {
  url: https://galaxy.scalar.com/planets/1
}

headers {
  Content-Type: application/json
}
Bruno
delete {
  url: https://galaxy.scalar.com/planets/1
}

headers {
  Content-Type: application/json
}
cURL
curl -X DELETE \
'https://galaxy.scalar.com/planets/1' \
 -H "Content-Type: application/json"
JavaScript
fetch('https://galaxy.scalar.com/planets/1', {method:'DELETE',headers:{'Content-Type':'application/json'}})
  .then(response => response.json())
  .then(data => console.log(data));
PHP
<?php
$url = 'https://galaxy.scalar.com/planets/1';
$method = 'DELETE';
$headers = [
    'Content-Type' => 'application/json',
];

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$response = curl_exec($ch);
curl_close($ch);

echo $response;
?>
Python
import requests

url = 'https://galaxy.scalar.com/planets/1'

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

response = requests.delete(url, headers=headers)
print(response.json())

ID: uploadImage

Upload an image to a planet

POST
/planets/{planetId}/image
Server

Got a crazy good photo of a planet? Share it with the world!

Authorizations

bearerAuth

JWT Bearer token authentication

TypeHTTP (bearer)
or
basicAuth

Basic HTTP authentication

TypeHTTP (basic)
or
apiKeyQuery

API key query parameter

TypeAPI Key (query: api_key)
or
apiKeyHeader

API key request header

TypeAPI Key (header: X-API-Key)
or
apiKeyCookie

API key browser cookie

TypeAPI Key (cookie: api_key)
or
oAuth2

OAuth 2.0 authentication

authorizationCode Flow:
Authorization URL: https://galaxy.scalar.com/oauth/authorizeToken URL: https://galaxy.scalar.com/oauth/token
Scopes:
  • read:account: read your account information
  • write:planets: modify planets in your account
  • read:planets: read your planets
clientCredentials Flow:
Authorization URL: Token URL: https://galaxy.scalar.com/oauth/token
Scopes:
  • read:account: read your account information
  • write:planets: modify planets in your account
  • read:planets: read your planets
implicit Flow:
Authorization URL: https://galaxy.scalar.com/oauth/authorizeToken URL:
Scopes:
  • read:account: read your account information
  • write:planets: modify planets in your account
  • read:planets: read your planets
password Flow:
Authorization URL: Token URL: https://galaxy.scalar.com/oauth/token
Scopes:
  • read:account: read your account information
  • write:planets: modify planets in your account
  • read:planets: read your planets

Parameters

Path Parameters

planetId*
Typeinteger
Required
Example1
formatint64

Request Body

JSON
{
"image": "string"
}

Responses

Image uploaded
application/json
JSON
{
"message": "Image uploaded successfully"
}

Samples

Bruno
post {
  url: https://galaxy.scalar.com/planets/1/image
}

headers {
  Content-Type: application/json
}
Bruno
post {
  url: https://galaxy.scalar.com/planets/1/image
}

headers {
  Content-Type: application/json
}
cURL
curl -X POST \
'https://galaxy.scalar.com/planets/1/image' \
 -H "Content-Type: application/json"
JavaScript
fetch('https://galaxy.scalar.com/planets/1/image', {method:'POST',headers:{'Content-Type':'application/json'}})
  .then(response => response.json())
  .then(data => console.log(data));
PHP
<?php
$url = 'https://galaxy.scalar.com/planets/1/image';
$method = 'POST';
$headers = [
    'Content-Type' => 'application/json',
];

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$response = curl_exec($ch);
curl_close($ch);

echo $response;
?>
Python
import requests

url = 'https://galaxy.scalar.com/planets/1/image'

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

response = requests.post(url, headers=headers)
print(response.json())

Authentication

Some endpoints are public, but some require authentication. We provide all the required endpoints to create an account and authorize yourself.


ID: createUser

Create a user

POST
/user/signup
Server

Time to create a user account, eh?

Request Body

JSON
{
"name": "Marc",
"email": "marc@scalar.com",
"password": "i-love-scalar"
}

Responses

Created
application/json
JSON
{
"id": 1,
"name": "Marc",
"email": "marc@scalar.com",
"password": "i-love-scalar"
}

Samples

Bruno
post {
  url: https://galaxy.scalar.com/user/signup
}

headers {
  Content-Type: application/json
}
Bruno
post {
  url: https://galaxy.scalar.com/user/signup
}

headers {
  Content-Type: application/json
}
cURL
curl -X POST \
'https://galaxy.scalar.com/user/signup' \
 -H "Content-Type: application/json"
JavaScript
fetch('https://galaxy.scalar.com/user/signup', {method:'POST',headers:{'Content-Type':'application/json'}})
  .then(response => response.json())
  .then(data => console.log(data));
PHP
<?php
$url = 'https://galaxy.scalar.com/user/signup';
$method = 'POST';
$headers = [
    'Content-Type' => 'application/json',
];

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$response = curl_exec($ch);
curl_close($ch);

echo $response;
?>
Python
import requests

url = 'https://galaxy.scalar.com/user/signup'

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

response = requests.post(url, headers=headers)
print(response.json())

ID: getToken

Get a token

POST
/auth/token
Server

Yeah, this is the boring security stuff. Just get your super secret token and move on.

Request Body

JSON
{
"email": "marc@scalar.com",
"password": "i-love-scalar"
}

Responses

Token Created
application/json
JSON
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
}

Samples

Bruno
post {
  url: https://galaxy.scalar.com/auth/token
}

headers {
  Content-Type: application/json
}
Bruno
post {
  url: https://galaxy.scalar.com/auth/token
}

headers {
  Content-Type: application/json
}
cURL
curl -X POST \
'https://galaxy.scalar.com/auth/token' \
 -H "Content-Type: application/json"
JavaScript
fetch('https://galaxy.scalar.com/auth/token', {method:'POST',headers:{'Content-Type':'application/json'}})
  .then(response => response.json())
  .then(data => console.log(data));
PHP
<?php
$url = 'https://galaxy.scalar.com/auth/token';
$method = 'POST';
$headers = [
    'Content-Type' => 'application/json',
];

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$response = curl_exec($ch);
curl_close($ch);

echo $response;
?>
Python
import requests

url = 'https://galaxy.scalar.com/auth/token'

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

response = requests.post(url, headers=headers)
print(response.json())

ID: getMe

Get authenticated user

GET
/me
Server

Find yourself they say. That’s what you can do here.

Authorizations

basicAuth

Basic HTTP authentication

TypeHTTP (basic)
or
oAuth2

OAuth 2.0 authentication

authorizationCode Flow:
Authorization URL: https://galaxy.scalar.com/oauth/authorizeToken URL: https://galaxy.scalar.com/oauth/token
Scopes:
  • read:account: read your account information
  • write:planets: modify planets in your account
  • read:planets: read your planets
clientCredentials Flow:
Authorization URL: Token URL: https://galaxy.scalar.com/oauth/token
Scopes:
  • read:account: read your account information
  • write:planets: modify planets in your account
  • read:planets: read your planets
implicit Flow:
Authorization URL: https://galaxy.scalar.com/oauth/authorizeToken URL:
Scopes:
  • read:account: read your account information
  • write:planets: modify planets in your account
  • read:planets: read your planets
password Flow:
Authorization URL: Token URL: https://galaxy.scalar.com/oauth/token
Scopes:
  • read:account: read your account information
  • write:planets: modify planets in your account
  • read:planets: read your planets
or
bearerAuth

JWT Bearer token authentication

TypeHTTP (bearer)
or
apiKeyHeader

API key request header

TypeAPI Key (header: X-API-Key)
or
apiKeyQuery

API key query parameter

TypeAPI Key (query: api_key)

Responses

OK
application/json
JSON
{
"id": 1,
"name": "Marc",
"email": "marc@scalar.com",
"password": "i-love-scalar"
}

Samples

Bruno
get {
  url: https://galaxy.scalar.com/me
}

headers {
  Content-Type: application/json
}
Bruno
get {
  url: https://galaxy.scalar.com/me
}

headers {
  Content-Type: application/json
}
cURL
curl -X GET \
'https://galaxy.scalar.com/me' \
 -H "Content-Type: application/json"
JavaScript
fetch('https://galaxy.scalar.com/me', {headers:{'Content-Type':'application/json'}})
  .then(response => response.json())
  .then(data => console.log(data));
PHP
<?php
$url = 'https://galaxy.scalar.com/me';
$method = 'GET';
$headers = [
    'Content-Type' => 'application/json',
];

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$response = curl_exec($ch);
curl_close($ch);

echo $response;
?>
Python
import requests

url = 'https://galaxy.scalar.com/me'

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

response = requests.get(url, headers=headers)
print(response.json())

Powered by VitePress OpenAPI