Skip to content

API Usage Cookbook for Bare Metal

This guide shows how to create and publish a bare metal compute instance using REST API.

Authentication: All API requests must include your API key in the X-API-KEY header.

API Documentation: For interactive API exploration and full endpoint reference, visit the SharonAI API Documentation.


Table of contents

Copy-Ready Variables

Use this block as your default shell setup for bare metal provisioning.

export API_KEY="ra2.your-api-key"
export BASE_URL="https://console.compute.sharonai.cloud"
export PROJECT_NAME="defaultproject"
export WORKSPACE_NAME="platforms"
export INSTANCE_NAME="bm-customer-instance"
export COMPUTE_PROFILE_NAME="od-h100-bm"

Bare Metal Compute Instance Payload

Create a payload-baremetal.json file:

cat > payload-baremetal.json <<JSON
{
  "apiVersion": "paas.envmgmt.io/v1",
  "kind": "ComputeInstance",
  "metadata": {
    "name": "${INSTANCE_NAME}",
    "labels": {
      "paas.envmgmt.io/inventory": "baremetal"
    },
    "workspace": "${WORKSPACE_NAME}",
    "project": "${PROJECT_NAME}"
  },
  "spec": {
    "computeProfile": {
      "name": "${COMPUTE_PROFILE_NAME}",
      "systemCatalog": true
    }
  }
}
JSON

Create Bare Metal Compute Instance

curl -sS -X POST "${BASE_URL}/apis/paas.envmgmt.io/v1/projects/${PROJECT_NAME}/workspaces/${WORKSPACE_NAME}/computeinstances" \
  -H "X-API-KEY: $API_KEY" \
  -H "Content-Type: application/json" \
  -d @payload-baremetal.json

Publish Bare Metal Compute Instance

curl -sS -X POST "${BASE_URL}/apis/paas.envmgmt.io/v1/projects/${PROJECT_NAME}/workspaces/${WORKSPACE_NAME}/computeinstances/${INSTANCE_NAME}/publish" \
  -H "accept: application/json" \
  -H "X-API-KEY: $API_KEY"

Manage Bare Metal Compute Instance

Use these actions after publish to control instance power state.

Stop Bare Metal Compute Instance

curl -sS -X POST "${BASE_URL}/apis/paas.envmgmt.io/v1/projects/${PROJECT_NAME}/workspaces/${WORKSPACE_NAME}/computeinstances/${INSTANCE_NAME}/action/stop" \
  -H "accept: application/json" \
  -H "X-API-KEY: $API_KEY" \
  -H "Content-Type: application/json"

Start Bare Metal Compute Instance

curl -sS -X POST "${BASE_URL}/apis/paas.envmgmt.io/v1/projects/${PROJECT_NAME}/workspaces/${WORKSPACE_NAME}/computeinstances/${INSTANCE_NAME}/action/start" \
  -H "accept: application/json" \
  -H "X-API-KEY: $API_KEY" \
  -H "Content-Type: application/json"

Reboot Bare Metal Compute Instance

curl -sS -X POST "${BASE_URL}/apis/paas.envmgmt.io/v1/projects/${PROJECT_NAME}/workspaces/${WORKSPACE_NAME}/computeinstances/${INSTANCE_NAME}/action/reboot" \
  -H "accept: application/json" \
  -H "X-API-KEY: $API_KEY" \
  -H "Content-Type: application/json"

Destroy Bare Metal Compute Instance

curl -sS -X POST "${BASE_URL}/apis/paas.envmgmt.io/v1/projects/${PROJECT_NAME}/workspaces/${WORKSPACE_NAME}/computeinstances/${INSTANCE_NAME}/destroy" \
  -H "accept: application/json" \
  -H "X-API-KEY: $API_KEY"