Api Definition API
Upload an OpenAPI definition
| Path | Method | Protected | 
|---|---|---|
/v1/api/definitions/import | PUT | No | 
Uploads an OpenAPI JSON document and either creates a new one or updates an existing Golem API definition using it.
Example Request JSON
nullExample Response JSON
{
  "id": "string",
  "version": "string",
  "routes": [
    {
      "method": "Get",
      "path": "string",
      "binding": {
        "componentId": "616ccd92-d666-4180-8349-8d125b269fac",
        "workerName": "string",
        "idempotencyKey": "string",
        "response": "string"
      }
    }
  ],
  "draft": true
}Get or list API definitions
| Path | Method | Protected | 
|---|---|---|
/v1/api/definitions | GET | No | 
If api_definition_id is specified, returns a single API definition.
Otherwise lists all API definitions.
Query Parameters
| Name | Type | Required | Description | 
|---|---|---|---|
| api-definition-id | string | No | - | 
Example Response JSON
[
  {
    "id": "string",
    "version": "string",
    "routes": [
      {
        "method": "Get",
        "path": "string",
        "binding": {
          "componentId": "616ccd92-d666-4180-8349-8d125b269fac",
          "workerName": "string",
          "idempotencyKey": "string",
          "response": "string"
        }
      }
    ],
    "draft": true
  }
]Create a new API definition
| Path | Method | Protected | 
|---|---|---|
/v1/api/definitions | POST | No | 
Creates a new API definition described by Golem's API definition JSON document. If an API definition of the same version already exists, its an error.
Example Request JSON
{
  "id": "string",
  "version": "string",
  "routes": [
    {
      "method": "Get",
      "path": "string",
      "binding": {
        "componentId": "616ccd92-d666-4180-8349-8d125b269fac",
        "workerName": "string",
        "idempotencyKey": "string",
        "response": "string"
      }
    }
  ],
  "draft": true
}Example Response JSON
{
  "id": "string",
  "version": "string",
  "routes": [
    {
      "method": "Get",
      "path": "string",
      "binding": {
        "componentId": "616ccd92-d666-4180-8349-8d125b269fac",
        "workerName": "string",
        "idempotencyKey": "string",
        "response": "string"
      }
    }
  ],
  "draft": true
}Get an API definition
| Path | Method | Protected | 
|---|---|---|
/v1/api/definitions/{id}/{version} | GET | No | 
An API definition is selected by its API definition ID and version.
Example Response JSON
{
  "id": "string",
  "version": "string",
  "routes": [
    {
      "method": "Get",
      "path": "string",
      "binding": {
        "componentId": "616ccd92-d666-4180-8349-8d125b269fac",
        "workerName": "string",
        "idempotencyKey": "string",
        "response": "string"
      }
    }
  ],
  "draft": true
}Update an existing API definition.
| Path | Method | Protected | 
|---|---|---|
/v1/api/definitions/{id}/{version} | PUT | No | 
Only draft API definitions can be updated.
Example Request JSON
{
  "id": "string",
  "version": "string",
  "routes": [
    {
      "method": "Get",
      "path": "string",
      "binding": {
        "componentId": "616ccd92-d666-4180-8349-8d125b269fac",
        "workerName": "string",
        "idempotencyKey": "string",
        "response": "string"
      }
    }
  ],
  "draft": true
}Example Response JSON
{
  "id": "string",
  "version": "string",
  "routes": [
    {
      "method": "Get",
      "path": "string",
      "binding": {
        "componentId": "616ccd92-d666-4180-8349-8d125b269fac",
        "workerName": "string",
        "idempotencyKey": "string",
        "response": "string"
      }
    }
  ],
  "draft": true
}Delete an API definition
| Path | Method | Protected | 
|---|---|---|
/v1/api/definitions/{id}/{version} | DELETE | No | 
Deletes an API definition by its API definition ID and version.
Example Response JSON
"string"Api Definition API Errors
| Status Code | Description | Body | 
|---|---|---|
| 400 | {"type":"Messages","errors":["string"]} | |
| 401 | {"error":"string"} | |
| 403 | {"error":"string"} | |
| 404 | {"error":"string"} | |
| 409 | "string" | |
| 500 | {"error":"string"} |