Component API
Get all components
Path | Method | Protected |
---|---|---|
/v1/components | GET | No |
Gets all components, optionally filtered by component name.
Query Parameters
Name | Type | Required | Description |
---|---|---|---|
component-name | string | No | - |
Example Response JSON
[
{
"versionedComponentId": {
"componentId": "616ccd92-d666-4180-8349-8d125b269fac",
"version": 0
},
"componentName": "string",
"componentSize": 0,
"metadata": {
"exports": [
{
"type": "Function",
"name": "string",
"parameters": [
{
"name": "string",
"typ": {
"type": "Variant",
"cases": [
{
"name": "string",
"typ": {}
}
]
}
}
],
"results": [
{
"name": "string",
"typ": {
"type": "Variant",
"cases": [
{
"name": "string",
"typ": {}
}
]
}
}
]
}
],
"producers": [
{
"fields": [
{
"name": "string",
"values": [
{
"name": "string",
"version": "string"
}
]
}
]
}
],
"memories": [
{
"initial": 0,
"maximum": 0
}
]
}
}
]
Create a new component
Path | Method | Protected |
---|---|---|
/v1/components | POST | No |
The request body is encoded as multipart/form-data containing metadata and the WASM binary.
Request Form: multipart/form-data
Make sure to include
Content-Type: multipart/form-data
Header
Field name
: string undefined
Field component
: string binary
Example Response JSON
{
"versionedComponentId": {
"componentId": "616ccd92-d666-4180-8349-8d125b269fac",
"version": 0
},
"componentName": "string",
"componentSize": 0,
"metadata": {
"exports": [
{
"type": "Function",
"name": "string",
"parameters": [
{
"name": "string",
"typ": {
"type": "Variant",
"cases": [
{
"name": "string",
"typ": {}
}
]
}
}
],
"results": [
{
"name": "string",
"typ": {
"type": "Variant",
"cases": [
{
"name": "string",
"typ": {}
}
]
}
}
]
}
],
"producers": [
{
"fields": [
{
"name": "string",
"values": [
{
"name": "string",
"version": "string"
}
]
}
]
}
],
"memories": [
{
"initial": 0,
"maximum": 0
}
]
}
}
Update a component
Path | Method | Protected |
---|---|---|
/v1/components/{component_id}/upload | PUT | No |
Request Body: WASM Binary File
Make sure to include
Content-Type: application/octet-stream
Header
Example Response JSON
{
"versionedComponentId": {
"componentId": "616ccd92-d666-4180-8349-8d125b269fac",
"version": 0
},
"componentName": "string",
"componentSize": 0,
"metadata": {
"exports": [
{
"type": "Function",
"name": "string",
"parameters": [
{
"name": "string",
"typ": {
"type": "Variant",
"cases": [
{
"name": "string",
"typ": {}
}
]
}
}
],
"results": [
{
"name": "string",
"typ": {
"type": "Variant",
"cases": [
{
"name": "string",
"typ": {}
}
]
}
}
]
}
],
"producers": [
{
"fields": [
{
"name": "string",
"values": [
{
"name": "string",
"version": "string"
}
]
}
]
}
],
"memories": [
{
"initial": 0,
"maximum": 0
}
]
}
}
Download a component
Path | Method | Protected |
---|---|---|
/v1/components/{component_id}/download | GET | No |
Downloads a specific version of the component's WASM.
Query Parameters
Name | Type | Required | Description |
---|---|---|---|
version | integer | No | - |
Response Body: WASM Binary File
Get the metadata for all component versions
Path | Method | Protected |
---|---|---|
/v1/components/{component_id} | GET | No |
Each component can have multiple versions. Every time a new WASM is uploaded for a given component id, that creates a new version. This endpoint returns a list of all versions for the component id provided as part of the URL. Each element of the response describes a single version of a component, but does not contain the binary (WASM) itself:
versionedComponentId
associates a specific version with the component iduserComponentId
and protectedComponentId are implementation details, not used elsewhere on the public APIcomponentName
is the human-readable name of the componentcomponentSize
is the WASM binary's size in bytesmetadata
contains information extracted from the WASM itselfmetadata.exports
is a list of exported functions, including their parameter's and return value's typesmetadata.producers
is a list of producer information added by tooling, each consisting of a list of fields associating one or more values to a given key. This contains information about what compilers and other WASM related tools were used to construct the Golem component.
Example Response JSON
[
{
"versionedComponentId": {
"componentId": "616ccd92-d666-4180-8349-8d125b269fac",
"version": 0
},
"componentName": "string",
"componentSize": 0,
"metadata": {
"exports": [
{
"type": "Function",
"name": "string",
"parameters": [
{
"name": "string",
"typ": {
"type": "Variant",
"cases": [
{
"name": "string",
"typ": {}
}
]
}
}
],
"results": [
{
"name": "string",
"typ": {
"type": "Variant",
"cases": [
{
"name": "string",
"typ": {}
}
]
}
}
]
}
],
"producers": [
{
"fields": [
{
"name": "string",
"values": [
{
"name": "string",
"version": "string"
}
]
}
]
}
],
"memories": [
{
"initial": 0,
"maximum": 0
}
]
}
}
]
Get the version of a given component
Path | Method | Protected |
---|---|---|
/v1/components/{component_id}/versions/{version} | GET | No |
Gets the version of a component.
Example Response JSON
{
"versionedComponentId": {
"componentId": "616ccd92-d666-4180-8349-8d125b269fac",
"version": 0
},
"componentName": "string",
"componentSize": 0,
"metadata": {
"exports": [
{
"type": "Function",
"name": "string",
"parameters": [
{
"name": "string",
"typ": {
"type": "Variant",
"cases": [
{
"name": "string",
"typ": {}
}
]
}
}
],
"results": [
{
"name": "string",
"typ": {
"type": "Variant",
"cases": [
{
"name": "string",
"typ": {}
}
]
}
}
]
}
],
"producers": [
{
"fields": [
{
"name": "string",
"values": [
{
"name": "string",
"version": "string"
}
]
}
]
}
],
"memories": [
{
"initial": 0,
"maximum": 0
}
]
}
}
Get the latest version of a given component
Path | Method | Protected |
---|---|---|
/v1/components/{component_id}/latest | GET | No |
Gets the latest version of a component.
Example Response JSON
{
"versionedComponentId": {
"componentId": "616ccd92-d666-4180-8349-8d125b269fac",
"version": 0
},
"componentName": "string",
"componentSize": 0,
"metadata": {
"exports": [
{
"type": "Function",
"name": "string",
"parameters": [
{
"name": "string",
"typ": {
"type": "Variant",
"cases": [
{
"name": "string",
"typ": {}
}
]
}
}
],
"results": [
{
"name": "string",
"typ": {
"type": "Variant",
"cases": [
{
"name": "string",
"typ": {}
}
]
}
}
]
}
],
"producers": [
{
"fields": [
{
"name": "string",
"values": [
{
"name": "string",
"version": "string"
}
]
}
]
}
],
"memories": [
{
"initial": 0,
"maximum": 0
}
]
}
}
Component API Errors
Status Code | Description | Body |
---|---|---|
400 | {"errors":["string"]} | |
401 | {"error":"string"} | |
403 | {"error":"string"} | |
404 | {"error":"string"} | |
409 | {"error":"string"} | |
500 | {"error":"string"} |