🎵 Decentralised Creative Network Server API – Simple Integration Guide

This guide shows how to use the Decentralised Creative Network Server API from any programming language (Python, JavaScript, etc.).

API address

 api.decentralised.art 

🔐 1. Authenticate user

# Step 1: Get Ethereum address from user's wallet
address = wallet.request_address()

# Step 2: Get login nonce from the server
nonce = GET /nonce/{address}

# Step 3: User signs the message
message = "Login nonce: " + nonce
signature = wallet.sign(message)

# Step 4: Send signed message to authenticate
POST /auth
  Headers:
    Content-Type: application/json
  Body:
    {
      "address": address,
      "message": message,
      "signature": signature
    }
  On success:
    Server sets cookies:
      - access_token
      - refresh_token

✅ After login, include these cookies in all authenticated API calls.


🔄 2. Refresh Token Automatically

# If any request returns 401 Unauthorized:
POST /refresh
  With cookies

# If successful:
Retry original request

🧩 3. Feature API

➕ Create Feature (requires login)

POST /feature
  Headers:
    Content-Type: application/json
  Body:
  {
    "name": "melody",
    "dimensions": [
      {
        "feature_name": "pitch",
        "transformations": [
          {
            "name": "scale",
            "args": [2]
          }
        ]
      },
      {
        "feature_name": "rhythm",
        "transformations": []
      }
    ]
  }
  Cookies: access_token required
  → Returns: { "name": "...", "version": "..." }

🔍 Get Feature (public)

GET /feature/{name}/{optional_version}
→ Returns: {
  "name": "...",
  "dimensions": [...]
}

🔄 4. Transformation API

➕ Create Transformation (requires login)

POST /transformation
  Headers:
    Content-Type: application/json
  Body:
    {
      "name": "scale",
      "sol_src": "Solidity code here"
    }
  Cookies: access_token required
  → Returns: { "name": "...", "version": "..." }

🔍 Get Transformation (public)

GET /transformation/{name}/{optional_version}
→ Returns: {
  "name": "...",
  "sol_src": "..."
}

⚙️ 5. Execute Contract (public)

GET /execute/{feature_name}/{N}/{startPoints}
→ Returns: Execution result

# Example:
GET /execute/pitch/10/[0,1,2]

📝 Notes