Skip to content
API v2v2.0.0 · 11 endpoints
GitHubDiscord

Upload an image to a planet

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

Planets
POST
https://galaxy.scalar.com/planets/{planetId}/image
Try it
Authorization (bearerAuth)

path Parameters

planetIdinteger <int64>required

The ID of the planet to get

Example 1

Authorization

  • bearerAuth (bearer)

    JWT Bearer token authentication

  • basicAuth (basic)

    Basic HTTP authentication

  • apiKeyQuery (query: api_key)

    API key query parameter

  • apiKeyHeader (header: X-API-Key)

    API key request header

  • apiKeyCookie (cookie: api_key)

    API key browser cookie

  • oAuth2 (oauth2)

    OAuth 2.0 authentication

  • openIdConnect (openIdConnect)

    OpenID Connect Authentication

Request Body

Image to upload

multipart/form-data

object
image?
string <binary>

The image file to upload

Responses

200

Image uploaded

Media Type
ImageUploadedMessage

Message about an image upload

message?
string
imageUrl?
string

The URL where the uploaded image can be accessed

uploadedAt?
string <date-time>

Timestamp when the image was uploaded

fileSize?
integer

Size of the uploaded image in bytes

mimeType?
string

The content type of the uploaded image

400

Bad Request

Media Type
BadRequestError

RFC 7807 (https://datatracker.ietf.org/doc/html/rfc7807)

type?
string
title?
string
status?
integer <int64>
detail?
string
403

Forbidden

Media Type
ForbiddenError

Error response for forbidden access (RFC 7807). Returned when the user does not have permission to access the requested resource.

type?
string
title?
string
status?
integer <int64>
detail?
string
404

Not Found

Media Type
NotFoundError

Error response for resource not found (RFC 7807). Returned when the requested resource does not exist.

type?
string
title?
string
status?
integer <int64>
detail?
string

Code Samples

curl -X POST 'https://galaxy.scalar.com/planets/{planetId}/image' \
  -H 'Authorization: Basic <base64-credentials>' \
  -H 'X-API-Key: <X-API-Key>' \
  -H 'Content-Type: application/json' \
  -d '{
  "image": "@mars.jpg"
}'

Example Responses

{
  "message": "Image uploaded successfully",
  "imageUrl": "https://cdn.scalar.com/images/8f47c132-9d1f-4f83-b5a4-91db5ee757ab.jpg",
  "uploadedAt": "2024-01-15T14:30:00.000Z",
  "fileSize": 1048576,
  "mimeType": "image/jpeg"
}