Api Definition API
Upload an OpenAPI definition
Path | Method | Protected |
---|---|---|
/v1/api/definitions/{project_id}/import | PUT | Yes |
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
Path | Method | Protected |
---|---|---|
/v1/api/definitions/{project_id} | GET | Yes |
Lists all API definitions associated with the project.
Query Parameters
Name | Type | Required | Description |
---|---|---|---|
api-definition-id | string | No | - |
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
Path | Method | Protected |
---|---|---|
/v1/api/definitions/{project_id} | POST | Yes |
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
Path | Method | Protected |
---|---|---|
/v1/api/definitions/{project_id}/{id}/{version} | GET | Yes |
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.
Path | Method | Protected |
---|---|---|
/v1/api/definitions/{project_id}/{id}/{version} | PUT | Yes |
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
Path | Method | Protected |
---|---|---|
/v1/api/definitions/{project_id}/{id}/{version} | DELETE | Yes |
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 | {"message":"string"} | |
409 | "string" | |
500 | {"error":"string"} |