Hyper Docs
  • Introduction
  • What is Hyper
  • Why Hyper
  • Regions
  • Pricing
  • Quota and Limits
  • FAQ
  • Getting Started
    • Generate API Credential
    • Install CLI
    • Part 1 - Starting and inspecting your first container
    • Part 2 - Working with multiple containers
    • Part 3 - Hyper Compose
    • Migrate data
      • hyper container as client
      • hyper container as server
  • Features
    • Container
      • Container
      • Logs
      • Compose
      • Cron
      • Service
      • Func
    • Storage
      • Volume
      • Snapshot
    • Network
      • Network
      • Floating IP
      • Port
      • Security Group
    • Console
      • Filter
  • Reference
    • CLI
      • attach
      • commit
      • config
      • create
      • exec
      • images
      • info
      • inspect
      • kill
      • load
      • login
      • logout
      • logs
      • port
      • ps
      • pull
      • push
      • rename
      • restart
      • rm
      • rmi
      • run
      • search
      • start
      • stats
      • stop
      • version
      • update
      • wait
      • Volume
        • create
        • init
        • inspect
        • ls
        • rm
      • Snapshot
        • create
        • ls
        • rm
      • FIP
        • allocate
        • attach
        • detach
        • ls
        • release
        • name
      • Security Group
        • create
        • ls
        • inspect
        • rm
        • update
      • Compose
        • create
        • down
        • up
        • rm
        • ps
        • pull
        • run
        • kill
        • start
        • stop
        • scale
      • Service
        • create
        • ls
        • inspect
        • scale
        • rolling-update
        • attach-fip
        • detach-fip
        • rm
      • Cron
        • create
        • inspect
        • ls
        • history
        • rm
      • Func
        • create
        • update
        • inspect
        • ls
        • rm
        • logs
        • call
        • get
    • API
      • 2016-04-04 [Ver. 1.23]
        • Container
          • List Containers
          • Create a container
          • Get container logs
          • Start a container
          • Stop a container
          • Restart a container
          • Resize a container
          • Rename a container
          • Kill a container
          • Attach to a container
          • Remove a container
          • Update a container
          • Get container stats
          • Inspect a container
          • Exec Create
          • Commit a container
        • Event
          • Monitor events with WebSocket
        • Misc
          • Display system-wide information
          • Show the hyper version information
          • Exec Start
          • Exec Resize
          • Exec Inspect
        • Image
          • Inspect Images
          • Search Images
          • List Images
          • Load Images
          • Create an image
          • Remove an image
          • Push an image
        • Volume
          • List volumes
          • Create a volume
          • Remove a volume
          • Init a volume
          • Inspect a volume
        • Snapshot
          • Create a snapshot
          • List snapshots
          • Inspect a snapshot
          • Remove a snapshot
        • Network
          • Allocate floating IP
          • Attach a floating IP to a (running) container
          • Detach floating IP from a (running) container
          • List floating IP
          • Release floating IP
          • Name floating IP
        • Security Group
          • Create a security group
          • Remove a security group
          • Inspect a security group
          • Update a security group
          • List security groups
        • Service
          • service create
          • service list
          • service inspect
          • service update
          • service remove
        • Compose
          • Compose up
          • Compose create
          • Compose down
          • Compose rm
          • Compose start
          • Compose stop
          • Compose kill
        • Cron
          • Cron create
          • Cron list
          • Cron inspect
          • Cron remove
          • Cron history
        • Func
          • Func create
          • Func update
          • Func list
          • Func inspect
          • Func remove
          • Func call
          • Func get
          • Func logs
          • Func status
    • Compose File Reference
    • Security Group Reference
  • FAQ
    • Pricing
    • Quota and Limits
    • Privacy Policy
    • Terms of Service
    • Acceptable Use Policy
  • Docs version
Powered by GitBook
On this page
  • Endpoints
  • Format
  • Authentication
  • Error Codes
  • Example
  • Step 0: Prepare the requests
  • Step 1: Create a canonical request
  • Step 2: Create a String to Sign
  • Step 3: Calculate the signature
  • Step4: Add the signature to the request
  1. Reference
  2. API

2016-04-04 [Ver. 1.23]

PreviousAPINextContainer

Last updated 7 years ago

NOTE: Parameters with the IGNORED mark are not supported in this version. Parameter value will be ignored.

Endpoints

  • Los Angeles:

  • Frankfurt:

Format

  • The API tends to be REST. However, for some complex commands, like attach

    or pull, the HTTP connection is hijacked to transport stdout,

    stdin and stderr.

  • When the client API version is newer than the daemon's, these calls return an HTTP

    400 Bad Request error message.

Authentication

Authenticate your account when using the API by signing the request with your access key ID and secret access key. You can manage your API keys in the .

Hyper API signature algorithm is based on , and there are several open source SDKs available:

  • Go:

  • Ruby:

  • Python:

  • NodeJS/Javascript:

NOTE: Difference between Hyper Signature and AWS Signature V4

  • Use host, region, service name Hyper instead of AWS.

  • Change the HTTP headers X-AMZ-* to X-Hyper-*

  • Change the literatures with "AWS" to "HYPER"

Error Codes

Hyper has two types of error codes:

  • Client errors: These errors are usually caused by something the client did, such as use an action or resource on behalf of a user that doesn't have permission to use the action or resource, or specify an identifier that is not valid. These errors are accompanied by a 400-series HTTP response code.

  • Server errors: These errors are usually caused by a server-side issue. These errors are accompanied by a 500-series HTTP response code.

Example

Step 0: Prepare the requests

The signed requests must include the following headers:

  • Content-Type, default value is application/json

  • X-Hyper-Date, the API timestamps, default value 20060102T150405Z (UTC time)

  • Host, the API endpoint, for example us-west-1.hyper.sh

Step 1: Create a canonical request

Hash the request body with SHA256, and write the hash in the Header X-Hyper-Content-Sha256.

Then, collect the headers to be hashed, including Content-Type, Content-Md5, Host, and all headers with X-Hyper- prefix. The headers are sorted by alphabet with the header name (lowercase) as key. Note, if the Host header contains a port, such as us-west-1.hyper.sh:443, the :port part will be dropped.

The headersTobeSign are joined with colon (:) and newline (\n), for example:

content-type:application/md5\nhost:us-west-1.hyper.sh\nx-hyper-content-sha256:111222333aaabbbcccddde\nx-hyper-date:20060102T150405Z\n

Then, join the headers with semicolon, for example

content-type;host;x-hyper-content-sha256;x-hyper-date

Then we could get the canonical request, which joins the following parts with newline(\n): request method, URI path, query string, the above headersTobeSign, the header list, and the hash of payload.

And we calculate the SHA256 checksum of Canonical Request.

Step 2: Create a String to Sign

The string to sign contains 4 parts, and joined with newline(\n):

  • Algorithm: literature "HYPER-HMAC-SHA256"

  • Request time stamp

  • Request scope, includes the following parts joined with slash(/)

    • Region: default is us-west-1

    • Service: default is hyper

    • Date: first 8 bytes of timestamp, e.g. the date part.

    • Literature "hyper_request"

  • The hex string of hashed canonical request got in step 1

Step 3: Calculate the signature

Use the HMAC SHA256 Algorithm to sign the request, we call it several times to get the signing key firstly:

kDate := hmacSHA256((keyPartsPrefix+secretKey), date)
kRegion := hmacSHA256(kDate, region)
kService := hmacSHA256(kRegion, service)
kSigning := hmacSHA256(kService, keyPartsRequest)

In the above code,

  • keyPartsPrefix is "HYPER",

  • secretKey is the user's secretKey

  • region and service are got in step 2, and

  • keyPartsRequest is "hyper_request"

Having gotten the kSigning, we calculate the Signature of the string in step 2 with another hmacSHA256:

hmacSHA256(signingKey, stringToSign)

Step4: Add the signature to the request

The signature will be inserted as Authorization header, the content are

HYPER-HMAC-SHA256  Credential={AccessKey}/{Request Scope}, SignedHeaders={Signed Header}, Signature={Signature}

Where the

  • {AccessKey} is the AccessKey of the user;

  • {Request Scope} is the request scope in step 2;

  • {Signed Header} is the semicolon joined header list in Step 1;

  • {Signature} is the signature we got in Step 3.

https://us-west-1.hyper.sh/v1.23
https://eu-central-1.hyper.sh/v1.23
console
AWS Signature Version 4
hyperhq/hypercli
drish/hyperb
tardyp/hyper_sh
npm: hyper-aws4