Skip to main content

Add a template component to a Stack

POST/v2/stacks/{stackId}/actions/add-template-component
API version
v2
Request method
POST
Operation ID
container-add-template-component

Request​

  • stackIdstring (uuid)required

    ID of the Stack where the component should be added.

Responses​

No response content specified.

Usage examples​

$ curl \
--fail \
--location \
-X POST \
-d '{"templateConfig":{"templateId":"postgres","userInputs":[{"name":"HOST","value":"postgres.example.org"}]}}' \
-H "Authorization: Bearer $MITTWALD_API_TOKEN" \
-H 'Content-Type: application/json' \
https://api.mittwald.de/v2/stacks/f0f86186-0a5a-45b2-aa33-502777496347/actions/add-template-component
import { MittwaldAPIV2Client } from "@mittwald/api-client";
import { assertStatus } from "@mittwald/api-client-commons";

const client = MittwaldAPIClient.newWithToken(process.env.MITTWALD_API_TOKEN);
const response = await client.container.addTemplateComponent({
"stackId": "f0f86186-0a5a-45b2-aa33-502777496347",
"data": {
"templateConfig": {
"templateId": "postgres",
"userInputs": [
{
"name": "HOST",
"value": "postgres.example.org"
}
]
}
}
});

assertStatus(response, 204);

use \Mittwald\ApiClient\Generated\V2\Clients\Container\AddTemplateComponent\AddTemplateComponentRequest;
use \Mittwald\ApiClient\Generated\V2\Clients\Container\AddTemplateComponent\AddTemplateComponentRequestBody;

$client = MittwaldAPIClient::newWithToken(getenv('MITTWALD_API_TOKEN'));

// TODO: Please consult the properties and constructor signature of
// AddTemplateComponentRequestBody to learn how to construct a valid instance
$body = new AddTemplateComponentRequestBody(/* TODO: ... */);

$request = (new AddTemplateComponentRequest(
stackId: "f0f86186-0a5a-45b2-aa33-502777496347",
body: $body
));
$response = $client->container()->addTemplateComponent($request);

var_dump($response->getBody();

On this page