Store a new ssh-key
POST/users/ self/ ssh-keys/
v2
POST
user-create-ssh-key
Request
Responses
Usage examples
- cURL
- JavaScript SDK
- PHP SDK
$ curl \
--fail \
--location \
-X POST \
-d '{"expiresAt":"2024-11-08T18:07:47.613Z","publicKey":"ssh-rsa ..."}' \
-H "Authorization: Bearer $MITTWALD_API_TOKEN" \
-H 'Content-Type: application/json' \
https://api.mittwald.de/v2/users/self/ssh-keys
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.user.createSshKey({
"data": {
"expiresAt": "2024-11-08T18:07:47.613Z",
"publicKey": "ssh-rsa ..."
}
});
assertStatus(response, 201);
use \Mittwald\ApiClient\Generated\V2\Clients\User\CreateSshKey\CreateSshKeyRequest;
use \Mittwald\ApiClient\Generated\V2\Clients\User\CreateSshKey\CreateSshKeyRequestBody;
$client = MittwaldAPIClient::newWithToken(getenv('MITTWALD_API_TOKEN'));
// TODO: Please consult the properties and constructor signature of
// CreateSshKeyRequestBody to learn how to construct a valid instance
$body = new CreateSshKeyRequestBody(/* TODO: ... */);
$request = (new CreateSshKeyRequest(
body: $body
));
$response = $client->user()->createSshKey($request);
var_dump($response->getBody();