#!/usr/bin/env bash # bash + curl + jq. Credentials come from your server environment. set -euo pipefail : "${MDG_BASE_URL:?MDG-approved HTTPS base URL including /api/v1}" : "${MDG_API_KEY:?Scoped server-side credential}" : "${ARTIST_ID:?An accessible MDG artist ID}" : "${EXTERNAL_RELEASE_ID:?Your stable external release ID}" : "${DRAFT_IDEMPOTENCY_KEY:?Persist a unique 16-128 character key for this exact draft request}" curl --fail-with-body --silent --show-error "$MDG_BASE_URL/identity" -H "Authorization: Bearer $MDG_API_KEY" curl --fail-with-body --silent --show-error "$MDG_BASE_URL/reference" -H "Authorization: Bearer $MDG_API_KEY" payload=$(jq -n --arg artistId "$ARTIST_ID" --arg externalId "$EXTERNAL_RELEASE_ID" '{title:"Your Release",artistId:$artistId,externalId:$externalId,releaseType:"single"}') curl --fail-with-body --silent --show-error "$MDG_BASE_URL/releases" \ -H "Authorization: Bearer $MDG_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $DRAFT_IDEMPOTENCY_KEY" --data "$payload" # Save release._id. Append tracks using POST /releases/{id}/tracks with a distinct # persisted Idempotency-Key and metadata from the OpenAPI TrackInput schema. # For each media file, compute sha256sum and exact byte length, then POST /uploads. # Example single part (only for a file no larger than returned chunkSize): # curl --fail-with-body -X PUT "$MDG_BASE_URL/uploads/$UPLOAD_ID/parts/0" \ # -H "Authorization: Bearer $MDG_API_KEY" -H "Upload-Token: $UPLOAD_TOKEN" -F "file=@$CHUNK_PATH" # POST /uploads/{id}/complete with {}, Upload-Token and its own persisted key. # POST /releases/{id}/validate with {}. Resolve findings using documented PATCHes. # POST /releases/{id}/submit with {} and a distinct persisted submission key. # GET /releases/{id}/fac and GET /releases/{id} to follow rights and admin review. # The JavaScript/Python examples perform the complete media + submission workflow.