Skip to main content

Create a Registry

POST/v2/projects/{projectId}/registries
API version
v2
Request method
POST
Operation ID
container-create-registry

Request​

  • projectIdstringrequired

    ID of the Project to create a Registry for.

Responses​

Format
application/json
Description

Created

  • credentialsobject
    • usernamestringrequired

      Your registry username.

    • validbooleanrequired

      Status of the credentials.

  • descriptionstringrequired
  • idstring (uuid)required
  • projectIdstring (uuid)required
  • uristringrequired
Content-Type: application/json

{
"credentials": {
"username": "username",
"valid": true
},
"description": "DockerHub",
"id": "f0f86186-0a5a-45b2-aa33-502777496347",
"projectId": "f0f86186-0a5a-45b2-aa33-502777496347",
"uri": "index.docker.io"
}
{
"properties": {
"credentials": {
"properties": {
"username": {
"description": "Your registry username.",
"example": "username",
"type": "string"
},
"valid": {
"description": "Status of the credentials.",
"example": true,
"type": "boolean"
}
},
"required": [
"username",
"valid"
],
"type": "object"
},
"description": {
"example": "DockerHub",
"type": "string"
},
"id": {
"format": "uuid",
"type": "string"
},
"projectId": {
"format": "uuid",
"type": "string"
},
"uri": {
"example": "index.docker.io",
"type": "string"
}
},
"required": [
"id",
"projectId",
"uri",
"description"
],
"type": "object"
}

Usage examples​

$ curl \
--fail \
--location \
-X POST \
-d '{"credentials":{"password":"password","username":"username"},"description":"DockerHub","uri":"index.docker.io"}' \
-H "Authorization: Bearer $MITTWALD_API_TOKEN" \
-H 'Content-Type: application/json' \
https://api.mittwald.de/v2/projects/string/registries
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.createRegistry({
"projectId": "string",
"data": {
"credentials": {
"password": "password",
"username": "username"
},
"description": "DockerHub",
"uri": "index.docker.io"
}
});

assertStatus(response, 201);

use \Mittwald\ApiClient\Generated\V2\Clients\Container\CreateRegistry\CreateRegistryRequest;
use \Mittwald\ApiClient\Generated\V2\Clients\Container\CreateRegistry\CreateRegistryRequestBody;

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

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

$request = (new CreateRegistryRequest(
projectId: "string",
body: $body
));
$response = $client->container()->createRegistry($request);

var_dump($response->getBody();

On this page