Welcome to the new Golem Cloud Docs! 👋
Documentation
API Definition

Api Definition API

Upload an OpenAPI definition

PathMethodProtected
/v1/api/definitions/{project_id}/importPUTYes

Uploads an OpenAPI JSON document and either creates a new one or updates an existing Golem API definition using it.

Example Response JSON

{
  "id": "string",
  "version": "string",
  "routes": [
    {
      "method": "Get",
      "path": "string",
      "security": "string",
      "binding": {
        "componentId": {
          "componentId": "616ccd92-d666-4180-8349-8d125b269fac",
          "version": 0
        },
        "workerName": "string",
        "idempotencyKey": "string",
        "response": "string",
        "bindingType": "default",
        "responseMappingInput": {
          "types": {
            "property1": {
              "type": "Variant",
              "cases": [
                {
                  "name": "string",
                  "typ": {}
                }
              ]
            },
            "property2": {
              "type": "Variant",
              "cases": [
                {
                  "name": "string",
                  "typ": {}
                }
              ]
            }
          }
        },
        "workerNameInput": {
          "types": {
            "property1": {
              "type": "Variant",
              "cases": [
                {
                  "name": "string",
                  "typ": {}
                }
              ]
            },
            "property2": {
              "type": "Variant",
              "cases": [
                {
                  "name": "string",
                  "typ": {}
                }
              ]
            }
          }
        },
        "idempotencyKeyInput": {
          "types": {
            "property1": {
              "type": "Variant",
              "cases": [
                {
                  "name": "string",
                  "typ": {}
                }
              ]
            },
            "property2": {
              "type": "Variant",
              "cases": [
                {
                  "name": "string",
                  "typ": {}
                }
              ]
            }
          }
        },
        "corsPreflight": {
          "allowOrigin": "string",
          "allowMethods": "string",
          "allowHeaders": "string",
          "exposeHeaders": "string",
          "allowCredentials": true,
          "maxAge": 0
        },
        "responseMappingOutput": {
          "analysed_type": {
            "type": "Variant",
            "cases": [
              {
                "name": "string",
                "typ": {}
              }
            ]
          }
        }
      }
    }
  ],
  "draft": true,
  "createdAt": "2019-08-24T14:15:22Z"
}

List API definitions

PathMethodProtected
/v1/api/definitions/{project_id}GETYes

Lists all API definitions associated with the project.

Query Parameters

NameTypeRequiredDescription
api-definition-idstringNo-

Example Response JSON

[
  {
    "id": "string",
    "version": "string",
    "routes": [
      {
        "method": "Get",
        "path": "string",
        "security": "string",
        "binding": {
          "componentId": {
            "componentId": "616ccd92-d666-4180-8349-8d125b269fac",
            "version": 0
          },
          "workerName": "string",
          "idempotencyKey": "string",
          "response": "string",
          "bindingType": "default",
          "responseMappingInput": {
            "types": {
              "property1": {
                "type": "Variant",
                "cases": [
                  {
                    "name": "string",
                    "typ": {}
                  }
                ]
              },
              "property2": {
                "type": "Variant",
                "cases": [
                  {
                    "name": "string",
                    "typ": {}
                  }
                ]
              }
            }
          },
          "workerNameInput": {
            "types": {
              "property1": {
                "type": "Variant",
                "cases": [
                  {
                    "name": "string",
                    "typ": {}
                  }
                ]
              },
              "property2": {
                "type": "Variant",
                "cases": [
                  {
                    "name": "string",
                    "typ": {}
                  }
                ]
              }
            }
          },
          "idempotencyKeyInput": {
            "types": {
              "property1": {
                "type": "Variant",
                "cases": [
                  {
                    "name": "string",
                    "typ": {}
                  }
                ]
              },
              "property2": {
                "type": "Variant",
                "cases": [
                  {
                    "name": "string",
                    "typ": {}
                  }
                ]
              }
            }
          },
          "corsPreflight": {
            "allowOrigin": "string",
            "allowMethods": "string",
            "allowHeaders": "string",
            "exposeHeaders": "string",
            "allowCredentials": true,
            "maxAge": 0
          },
          "responseMappingOutput": {
            "analysed_type": {
              "type": "Variant",
              "cases": [
                {
                  "name": "string",
                  "typ": {}
                }
              ]
            }
          }
        }
      }
    ],
    "draft": true,
    "createdAt": "2019-08-24T14:15:22Z"
  }
]

Create a new API definition

PathMethodProtected
/v1/api/definitions/{project_id}POSTYes

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 Response JSON

{
  "id": "string",
  "version": "string",
  "routes": [
    {
      "method": "Get",
      "path": "string",
      "security": "string",
      "binding": {
        "componentId": {
          "componentId": "616ccd92-d666-4180-8349-8d125b269fac",
          "version": 0
        },
        "workerName": "string",
        "idempotencyKey": "string",
        "response": "string",
        "bindingType": "default",
        "responseMappingInput": {
          "types": {
            "property1": {
              "type": "Variant",
              "cases": [
                {
                  "name": "string",
                  "typ": {}
                }
              ]
            },
            "property2": {
              "type": "Variant",
              "cases": [
                {
                  "name": "string",
                  "typ": {}
                }
              ]
            }
          }
        },
        "workerNameInput": {
          "types": {
            "property1": {
              "type": "Variant",
              "cases": [
                {
                  "name": "string",
                  "typ": {}
                }
              ]
            },
            "property2": {
              "type": "Variant",
              "cases": [
                {
                  "name": "string",
                  "typ": {}
                }
              ]
            }
          }
        },
        "idempotencyKeyInput": {
          "types": {
            "property1": {
              "type": "Variant",
              "cases": [
                {
                  "name": "string",
                  "typ": {}
                }
              ]
            },
            "property2": {
              "type": "Variant",
              "cases": [
                {
                  "name": "string",
                  "typ": {}
                }
              ]
            }
          }
        },
        "corsPreflight": {
          "allowOrigin": "string",
          "allowMethods": "string",
          "allowHeaders": "string",
          "exposeHeaders": "string",
          "allowCredentials": true,
          "maxAge": 0
        },
        "responseMappingOutput": {
          "analysed_type": {
            "type": "Variant",
            "cases": [
              {
                "name": "string",
                "typ": {}
              }
            ]
          }
        }
      }
    }
  ],
  "draft": true,
  "createdAt": "2019-08-24T14:15:22Z"
}

Get an API definition

PathMethodProtected
/v1/api/definitions/{project_id}/{id}/{version}GETYes

An API definition is selected by its API definition ID and version.

Example Response JSON

{
  "id": "string",
  "version": "string",
  "routes": [
    {
      "method": "Get",
      "path": "string",
      "security": "string",
      "binding": {
        "componentId": {
          "componentId": "616ccd92-d666-4180-8349-8d125b269fac",
          "version": 0
        },
        "workerName": "string",
        "idempotencyKey": "string",
        "response": "string",
        "bindingType": "default",
        "responseMappingInput": {
          "types": {
            "property1": {
              "type": "Variant",
              "cases": [
                {
                  "name": "string",
                  "typ": {}
                }
              ]
            },
            "property2": {
              "type": "Variant",
              "cases": [
                {
                  "name": "string",
                  "typ": {}
                }
              ]
            }
          }
        },
        "workerNameInput": {
          "types": {
            "property1": {
              "type": "Variant",
              "cases": [
                {
                  "name": "string",
                  "typ": {}
                }
              ]
            },
            "property2": {
              "type": "Variant",
              "cases": [
                {
                  "name": "string",
                  "typ": {}
                }
              ]
            }
          }
        },
        "idempotencyKeyInput": {
          "types": {
            "property1": {
              "type": "Variant",
              "cases": [
                {
                  "name": "string",
                  "typ": {}
                }
              ]
            },
            "property2": {
              "type": "Variant",
              "cases": [
                {
                  "name": "string",
                  "typ": {}
                }
              ]
            }
          }
        },
        "corsPreflight": {
          "allowOrigin": "string",
          "allowMethods": "string",
          "allowHeaders": "string",
          "exposeHeaders": "string",
          "allowCredentials": true,
          "maxAge": 0
        },
        "responseMappingOutput": {
          "analysed_type": {
            "type": "Variant",
            "cases": [
              {
                "name": "string",
                "typ": {}
              }
            ]
          }
        }
      }
    }
  ],
  "draft": true,
  "createdAt": "2019-08-24T14:15:22Z"
}

Update an existing API definition.

PathMethodProtected
/v1/api/definitions/{project_id}/{id}/{version}PUTYes

Only draft API definitions can be updated.

Example Response JSON

{
  "id": "string",
  "version": "string",
  "routes": [
    {
      "method": "Get",
      "path": "string",
      "security": "string",
      "binding": {
        "componentId": {
          "componentId": "616ccd92-d666-4180-8349-8d125b269fac",
          "version": 0
        },
        "workerName": "string",
        "idempotencyKey": "string",
        "response": "string",
        "bindingType": "default",
        "responseMappingInput": {
          "types": {
            "property1": {
              "type": "Variant",
              "cases": [
                {
                  "name": "string",
                  "typ": {}
                }
              ]
            },
            "property2": {
              "type": "Variant",
              "cases": [
                {
                  "name": "string",
                  "typ": {}
                }
              ]
            }
          }
        },
        "workerNameInput": {
          "types": {
            "property1": {
              "type": "Variant",
              "cases": [
                {
                  "name": "string",
                  "typ": {}
                }
              ]
            },
            "property2": {
              "type": "Variant",
              "cases": [
                {
                  "name": "string",
                  "typ": {}
                }
              ]
            }
          }
        },
        "idempotencyKeyInput": {
          "types": {
            "property1": {
              "type": "Variant",
              "cases": [
                {
                  "name": "string",
                  "typ": {}
                }
              ]
            },
            "property2": {
              "type": "Variant",
              "cases": [
                {
                  "name": "string",
                  "typ": {}
                }
              ]
            }
          }
        },
        "corsPreflight": {
          "allowOrigin": "string",
          "allowMethods": "string",
          "allowHeaders": "string",
          "exposeHeaders": "string",
          "allowCredentials": true,
          "maxAge": 0
        },
        "responseMappingOutput": {
          "analysed_type": {
            "type": "Variant",
            "cases": [
              {
                "name": "string",
                "typ": {}
              }
            ]
          }
        }
      }
    }
  ],
  "draft": true,
  "createdAt": "2019-08-24T14:15:22Z"
}

Delete an API definition

PathMethodProtected
/v1/api/definitions/{project_id}/{id}/{version}DELETEYes

Deletes an API definition by its API definition ID and version.

Example Response JSON

"string"

Api Definition API Errors

Status CodeDescriptionBody
400{"type":"Messages","errors":["string"]}
401{"error":"string"}
403{"error":"string"}
404{"message":"string"}
409"string"
500{"error":"string"}