diff --git a/README.md b/README.md index f16603f..7c54737 100644 --- a/README.md +++ b/README.md @@ -50,8 +50,8 @@ org_id = "your-staging-org-id" ``` **To get these values:** -1. **org_id**: Settings → Organization → Copy the org ID (or from URL: `app.axiom.co/{org_id}/...`) -2. **token**: Settings → Profile → Personal Access Tokens → Create token (use a Personal Access Token, not an API token, for full query access) +- **`org_id`** - The organization ID. Get it from Settings → Organization. +- **`token`** - Use an advanced API token with minimal privileges. The deployment name (e.g., `prod`, `staging`) is passed to scripts: `scripts/axiom-query prod "..."` diff --git a/skills/building-dashboards/README.md b/skills/building-dashboards/README.md index 8cb0e35..0145f29 100644 --- a/skills/building-dashboards/README.md +++ b/skills/building-dashboards/README.md @@ -34,7 +34,8 @@ token = "xaat-your-api-token" org_id = "your-org-id" ``` -Get your org_id from Settings → Organization. For the token, use a **Personal Access Token** (Settings → Profile → Personal Access Tokens) for full query access. +- **`org_id`** - The organization ID. Get it from Settings → Organization. +- **`token`** - Use an advanced API token with minimal privileges. **Tip:** Run `scripts/setup` from the `axiom-sre` skill for interactive configuration. diff --git a/skills/building-dashboards/scripts/axiom-api b/skills/building-dashboards/scripts/axiom-api index c4ad00e..8a758a7 100755 --- a/skills/building-dashboards/scripts/axiom-api +++ b/skills/building-dashboards/scripts/axiom-api @@ -6,10 +6,10 @@ # Reads credentials from ~/.axiom.toml (shared with axiom-sre) # # Examples: -# axiom-api prod GET /internal/dashboards -# axiom-api prod GET /internal/dashboards/abc123 -# axiom-api prod POST /internal/dashboards '{"name":"Test",...}' -# axiom-api prod GET /v2/user +# axiom-api prod GET /dashboards +# axiom-api prod GET /dashboards/abc123 +# axiom-api prod POST /dashboards '{"name":"Test",...}' +# axiom-api prod GET /user set -euo pipefail @@ -59,8 +59,7 @@ if [[ -z "$URL" || -z "$TOKEN" || -z "$ORG_ID" ]]; then exit 1 fi -# Dashboard API uses app.* instead of api.* -API_URL="${URL/api./app.}/api" +API_URL="${URL%/}/v2" CURL_ARGS=( -s diff --git a/skills/building-dashboards/scripts/dashboard-copy b/skills/building-dashboards/scripts/dashboard-copy index 3c76e12..deb7321 100755 --- a/skills/building-dashboards/scripts/dashboard-copy +++ b/skills/building-dashboards/scripts/dashboard-copy @@ -21,25 +21,26 @@ if [[ -z "$DEPLOYMENT" || -z "$ID" ]]; then fi # Fetch original -ORIGINAL=$("$SCRIPT_DIR/axiom-api" "$DEPLOYMENT" GET "/internal/dashboards/$ID") +ORIGINAL=$("$SCRIPT_DIR/axiom-api" "$DEPLOYMENT" GET "/dashboards/uid/$ID") # Get original name if new name not provided if [[ -z "$NEW_NAME" ]]; then - ORIG_NAME=$(echo "$ORIGINAL" | jq -r '.name') + ORIG_NAME=$(echo "$ORIGINAL" | jq -r '.dashboard.name') NEW_NAME="${ORIG_NAME} (copy)" fi -# Strip server fields and set new name +# Strip server fields and set new name on the dashboard subobject BODY=$(echo "$ORIGINAL" | jq --arg name "$NEW_NAME" ' - del(.id, .version, .createdAt, .updatedAt, .createdBy, .updatedBy) | + .dashboard | + del(.id, .uid, .version, .createdAt, .updatedAt, .createdBy, .updatedBy) | .name = $name -') +' | jq '{dashboard: .}') -RESPONSE=$("$SCRIPT_DIR/axiom-api" "$DEPLOYMENT" POST "/internal/dashboards" "$BODY") +RESPONSE=$("$SCRIPT_DIR/axiom-api" "$DEPLOYMENT" POST "/dashboards" "$BODY") -# Print new ID and name -ID=$(echo "$RESPONSE" | jq -r '.id // empty') -NAME=$(echo "$RESPONSE" | jq -r '.name // empty') +# Print new UID and name +ID=$(echo "$RESPONSE" | jq -r '.dashboard.uid // empty') +NAME=$(echo "$RESPONSE" | jq -r '.dashboard.dashboard.name // empty') if [[ -n "$ID" ]]; then echo -e "${ID}\t${NAME}" diff --git a/skills/building-dashboards/scripts/dashboard-create b/skills/building-dashboards/scripts/dashboard-create index 372866a..00c8164 100755 --- a/skills/building-dashboards/scripts/dashboard-create +++ b/skills/building-dashboards/scripts/dashboard-create @@ -36,14 +36,16 @@ fi # Read, strip server-managed fields, and normalize layout for react-grid-layout BODY=$(jq -L "$SCRIPT_DIR" ' include "dashboard-normalize"; - del(.id, .version, .createdAt, .updatedAt, .createdBy, .updatedBy) | + del(.id, .uid, .version, .createdAt, .updatedAt, .createdBy, .updatedBy) | normalize_dashboard_layout ' "$JSON_FILE") -RESPONSE=$("$SCRIPT_DIR/axiom-api" "$DEPLOYMENT" POST "/internal/dashboards" "$BODY") +BODY=$(echo "$BODY" | jq '{dashboard: .}') -# Extract and print the new dashboard ID -ID=$(echo "$RESPONSE" | jq -r '.id // empty') +RESPONSE=$("$SCRIPT_DIR/axiom-api" "$DEPLOYMENT" POST "/dashboards" "$BODY") + +# Extract and print the new dashboard UID +ID=$(echo "$RESPONSE" | jq -r '.dashboard.uid // empty') if [[ -n "$ID" ]]; then echo "$ID" else diff --git a/skills/building-dashboards/scripts/dashboard-delete b/skills/building-dashboards/scripts/dashboard-delete index 1700e6b..7ae99ea 100755 --- a/skills/building-dashboards/scripts/dashboard-delete +++ b/skills/building-dashboards/scripts/dashboard-delete @@ -28,5 +28,5 @@ if [[ ! $REPLY =~ ^[Yy]$ ]]; then exit 0 fi -"$SCRIPT_DIR/axiom-api" "$DEPLOYMENT" DELETE "/internal/dashboards/$ID" +"$SCRIPT_DIR/axiom-api" "$DEPLOYMENT" DELETE "/dashboards/uid/$ID" echo "Deleted: $ID" diff --git a/skills/building-dashboards/scripts/dashboard-get b/skills/building-dashboards/scripts/dashboard-get index ecb1879..5e17186 100755 --- a/skills/building-dashboards/scripts/dashboard-get +++ b/skills/building-dashboards/scripts/dashboard-get @@ -19,4 +19,4 @@ if [[ -z "$DEPLOYMENT" || -z "$ID" ]]; then exit 1 fi -"$SCRIPT_DIR/axiom-api" "$DEPLOYMENT" GET "/internal/dashboards/$ID" | jq . +"$SCRIPT_DIR/axiom-api" "$DEPLOYMENT" GET "/dashboards/uid/$ID" | jq '.dashboard' diff --git a/skills/building-dashboards/scripts/dashboard-list b/skills/building-dashboards/scripts/dashboard-list index e78dbfb..9e37d40 100755 --- a/skills/building-dashboards/scripts/dashboard-list +++ b/skills/building-dashboards/scripts/dashboard-list @@ -19,10 +19,10 @@ if [[ -z "$DEPLOYMENT" ]]; then exit 1 fi -RESPONSE=$("$SCRIPT_DIR/axiom-api" "$DEPLOYMENT" GET "/internal/dashboards?limit=1000") +RESPONSE=$("$SCRIPT_DIR/axiom-api" "$DEPLOYMENT" GET "/dashboards?limit=1000") if [[ "$FORMAT" == "--json" ]]; then echo "$RESPONSE" | jq . else - echo "$RESPONSE" | jq -r '.[] | [.id, .name] | @tsv' + echo "$RESPONSE" | jq -r '.[] | [.uid, .dashboard.name] | @tsv' fi diff --git a/skills/building-dashboards/scripts/dashboard-update b/skills/building-dashboards/scripts/dashboard-update index 54e45e0..12342a3 100755 --- a/skills/building-dashboards/scripts/dashboard-update +++ b/skills/building-dashboards/scripts/dashboard-update @@ -49,6 +49,12 @@ if [[ -z "$VERSION" ]]; then exit 1 fi -RESPONSE=$("$SCRIPT_DIR/axiom-api" "$DEPLOYMENT" PUT "/internal/dashboards/$ID" "$BODY") +# Wrap body in v2 envelope: {dashboard: {...}, version: N} +# Version must be a numeric int64. jq loses precision on large integers, +# so we inject it via string substitution. +DASHBOARD=$(echo "$BODY" | jq 'del(.version)') +BODY="{\"dashboard\":${DASHBOARD},\"version\":${VERSION}}" + +RESPONSE=$("$SCRIPT_DIR/axiom-api" "$DEPLOYMENT" PUT "/dashboards/uid/$ID" "$BODY") echo "$RESPONSE" | jq . diff --git a/skills/building-dashboards/tests/test-script-output.sh b/skills/building-dashboards/tests/test-script-output.sh index ff21916..5b294db 100755 --- a/skills/building-dashboards/tests/test-script-output.sh +++ b/skills/building-dashboards/tests/test-script-output.sh @@ -64,11 +64,11 @@ METHOD="${2:-}" PATH_="${3:-}" case "$METHOD:$PATH_" in - "POST:/internal/dashboards") - echo '{"id":"created-id"}' + "POST:/dashboards") + echo '{"status":"created","dashboard":{"uid":"created-uid","id":"created-id","version":1,"dashboard":{"name":"Test Dashboard"},"createdAt":"2026-02-01T10:00:00Z","updatedAt":"2026-02-01T10:00:00Z","createdBy":"alice@example.com","updatedBy":"alice@example.com"}}' ;; - "PUT:/internal/dashboards/dashboard-root-id") - echo '{"id":"dashboard-root-id","updated":true}' + "PUT:/dashboards/uid/dashboard-root-id") + echo '{"status":"updated","dashboard":{"uid":"dashboard-root-id","id":"dashboard-root-id","version":2,"dashboard":{"name":"Test Dashboard","updated":true},"createdAt":"2026-02-01T10:00:00Z","updatedAt":"2026-02-02T11:00:00Z","createdBy":"alice@example.com","updatedBy":"bob@example.com"}}' ;; *) echo "Unexpected call: $METHOD $PATH_" >&2 @@ -83,14 +83,14 @@ echo "Script Stdout Contract" echo "======================" create_out=$("$TMPDIR/dashboard-create" prod "$TMPDIR/input.json") -if [[ "$create_out" == "created-id" ]]; then - ok "dashboard-create outputs only dashboard ID" +if [[ "$create_out" == "created-uid" ]]; then + ok "dashboard-create outputs only dashboard UID" else - fail "dashboard-create outputs only dashboard ID" "got: $create_out" + fail "dashboard-create outputs only dashboard UID" "got: $create_out" fi update_out=$("$TMPDIR/dashboard-update" prod dashboard-root-id "$TMPDIR/input.json") -if echo "$update_out" | jq -e '.id == "dashboard-root-id" and .updated == true' > /dev/null 2>&1; then +if echo "$update_out" | jq -e '.dashboard.uid == "dashboard-root-id" and .dashboard.dashboard.updated == true' > /dev/null 2>&1; then ok "dashboard-update outputs valid JSON only" else fail "dashboard-update outputs valid JSON only" "got: $update_out" diff --git a/skills/controlling-costs/README.md b/skills/controlling-costs/README.md index 403e5d0..f4c6583 100644 --- a/skills/controlling-costs/README.md +++ b/skills/controlling-costs/README.md @@ -35,7 +35,8 @@ token = "xaat-your-api-token" org_id = "your-org-id" ``` -Get your org_id from Settings → Organization. For the token, use a **Personal Access Token** (Settings → Profile → Personal Access Tokens) for full query access. +- **`org_id`** - The organization ID. Get it from Settings → Organization. +- **`token`** - Use an advanced API token with minimal privileges. **Tip:** Run `scripts/setup` from the `axiom-sre` skill for interactive configuration. diff --git a/skills/query-metrics/README.md b/skills/query-metrics/README.md index aa19788..82a4f0b 100644 --- a/skills/query-metrics/README.md +++ b/skills/query-metrics/README.md @@ -36,7 +36,7 @@ token = "xaat-your-api-token" org_id = "your-org-id" ``` -Get your org_id from Settings → Organization. For the token, use a **Personal Access Token** (Settings → Profile → Personal Access Tokens) for full query access. +Get your org_id from Settings → Organization. For the token, create a scoped **API token** (Settings → API Tokens) with the permissions your workflow needs. Avoid Personal Access Tokens for automated tooling. **Tip:** Run `scripts/setup` from the `axiom-sre` skill for interactive configuration. diff --git a/skills/query-metrics/scripts/setup b/skills/query-metrics/scripts/setup index 6bedb63..7467df3 100755 --- a/skills/query-metrics/scripts/setup +++ b/skills/query-metrics/scripts/setup @@ -70,7 +70,7 @@ org_id = "your-org-id" EOF echo "" echo "Get your org_id from Settings → Organization." - echo "For the token, use a Personal Access Token (Settings → Profile → Personal Access Tokens)." + echo "For the token, create a scoped API token (Settings → API Tokens) with the permissions your workflow needs." fi echo "" diff --git a/skills/spl-to-apl/README.md b/skills/spl-to-apl/README.md index 3f8921e..6280c35 100644 --- a/skills/spl-to-apl/README.md +++ b/skills/spl-to-apl/README.md @@ -50,7 +50,7 @@ token = "xaat-your-api-token" org_id = "your-org-id" ``` -Get your org_id from Settings → Organization. For the token, use a **Personal Access Token** (Settings → Profile → Personal Access Tokens) for full query access. +Get your org_id from Settings → Organization. For the token, create a scoped **API token** (Settings → API Tokens) with the permissions your workflow needs. Avoid Personal Access Tokens for automated tooling. ## Related Skills diff --git a/skills/sre/README.md b/skills/sre/README.md index 7abbebd..90077f3 100644 --- a/skills/sre/README.md +++ b/skills/sre/README.md @@ -45,7 +45,7 @@ token = "xaat-your-api-token" org_id = "your-org-id" ``` -Get your org_id from Settings → Organization. For the token, use a **Personal Access Token** (Settings → Profile → Personal Access Tokens) for full query access. +Get your org_id from Settings → Organization. For the token, create a scoped **API token** (Settings → API Tokens) with the permissions your workflow needs. Avoid Personal Access Tokens for automated tooling. ## Usage