Zum Hauptinhalt springen

Create a ProjectInvite

POST/v2/projects/{projectId}/invites
API-Version
v2
Request-Methode
POST
Operation-ID
project-create-project-invite

Request​

  • projectIdstringrequired

    ID of the Project to create a ProjectInvite for.

Responses​

Format
application/json
Beschreibung

Created

  • avatarRefIdstring (uuid)

    Reference to the Project's avatar.

  • idstring (uuid)required

    ID of the ProjectInvite.

  • informationobjectrequired
    • invitationTokenstring

      Token for authentication purposes.

    • invitedBystring (uuid)required

      ID of the user that created the invite.

  • mailAddressstring (email)required

    Mail-address of the user the ProjectInvite is for.

  • membershipExpiresAtstring (date-time)

    Time the ProjectMembership should expire at.

  • messagestring

    Message contained in the ProjectInvite.

  • projectDescriptionstringrequired

    Description of the Project the invite is created for.

  • projectIdstring (uuid)required

    ID of the Project the invitation is for.

  • rolestring (einer von: notset, owner, emailadmin, external)required
Content-Type: application/json

{
"avatarRefId": "f0f86186-0a5a-45b2-aa33-502777496347",
"id": "f0f86186-0a5a-45b2-aa33-502777496347",
"information": {
"invitationToken": "string",
"invitedBy": "f0f86186-0a5a-45b2-aa33-502777496347"
},
"mailAddress": "email@mittwald.example",
"membershipExpiresAt": "1985-10-26T01:21:00.000Z",
"message": "string",
"projectDescription": "string",
"projectId": "f0f86186-0a5a-45b2-aa33-502777496347",
"role": "notset"
}
{
"properties": {
"avatarRefId": {
"description": "Reference to the Project's avatar.",
"format": "uuid",
"type": "string"
},
"id": {
"description": "ID of the ProjectInvite.",
"format": "uuid",
"type": "string"
},
"information": {
"properties": {
"invitationToken": {
"description": "Token for authentication purposes.",
"type": "string"
},
"invitedBy": {
"description": "ID of the user that created the invite.",
"format": "uuid",
"type": "string"
}
},
"required": [
"invitedBy"
],
"type": "object"
},
"mailAddress": {
"description": "Mail-address of the user the ProjectInvite is for.",
"format": "email",
"type": "string"
},
"membershipExpiresAt": {
"description": "Time the ProjectMembership should expire at.",
"format": "date-time",
"type": "string"
},
"message": {
"description": "Message contained in the ProjectInvite.",
"type": "string"
},
"projectDescription": {
"description": "Description of the Project the invite is created for.",
"type": "string"
},
"projectId": {
"description": "ID of the Project the invitation is for.",
"format": "uuid",
"type": "string"
},
"role": {
"enum": [
"notset",
"owner",
"emailadmin",
"external"
],
"type": "string"
}
},
"required": [
"id",
"projectId",
"mailAddress",
"role",
"information",
"projectDescription"
],
"type": "object"
}

Nutzungsbeispiele​

$ curl \
--fail \
--location \
-X POST \
-d '{"mailAddress":"email@mittwald.example","membershipExpiresAt":"1985-10-26T01:21:00.000Z","message":"string","role":"notset"}' \
-H "Authorization: Bearer $MITTWALD_API_TOKEN" \
-H 'Content-Type: application/json' \
https://api.mittwald.de/v2/projects/string/invites
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.project.createProjectInvite({
"projectId": "string",
"data": {
"mailAddress": "email@mittwald.example",
"membershipExpiresAt": "1985-10-26T01:21:00.000Z",
"message": "string",
"role": "notset"
}
});

assertStatus(response, 201);

use \Mittwald\ApiClient\Generated\V2\Clients\Project\CreateProjectInvite\CreateProjectInviteRequest;
use \Mittwald\ApiClient\Generated\V2\Clients\Project\CreateProjectInvite\CreateProjectInviteRequestBody;

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

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

$request = (new CreateProjectInviteRequest(
projectId: "string",
body: $body
));
$response = $client->project()->createProjectInvite($request);

var_dump($response->getBody();

Auf dieser Seite