- API-Referenz
- Konversation
- Create a conversation
Create a conversation
POST/v2/conversations
API-Version
v2
Request-Methode
POST
Operation-ID
conversation-create-conversation
Request
Format
application/json
- categoryIdstring
- mainUserIdstring (uuid)
- messageContentstring (≤ 8000 Zeichen)
- notificationRolesArray von string (einer von: customer_owner, customer_accountant, customer_member, project_owner, project_emailadmin, project_external)
- Array[
- *string (einer von: customer_owner, customer_accountant, customer_member, project_owner, project_emailadmin, project_external)
]
- relatedToeine von 7 Alternativen
- Alternativeobject
- aggregate"user"required
- domain"user"required
- idstringrequired
- Alternativeobject
- aggregate"customer"required
- domain"customer"required
- idstringrequired
- Alternativeobject
- aggregate"project"required
- domain"project"required
- idstringrequired
- Alternativeobject
- aggregate"appinstallation"required
- domain"app"required
- idstringrequired
- Alternativeobject
- aggregate"placementgroup"required
- domain"project"required
- idstringrequired
- Alternativeobject
- aggregate"extensionInstance"required
- domain"extension"required
- idstringrequired
- Alternativeobject
- aggregate"container"required
- domain"container"required
- idstringrequired
- sharedWitheine von 4 Alternativen
- Alternativeobject
- aggregate"user"required
- domain"user"required
- idstringrequired
- Alternativeobject
- aggregate"customer"required
- domain"customer"required
- idstringrequired
- Alternativeobject
- aggregate"project"required
- domain"project"required
- idstringrequired
- Alternativeobject
- aggregate"placementgroup"required
- domain"project"required
- idstringrequired
- titlestring
Content-Type: application/json
{
"categoryId": "string",
"mainUserId": "f0f86186-0a5a-45b2-aa33-502777496347",
"messageContent": "string",
"notificationRoles": [
"customer_owner"
],
"relatedTo": {
"aggregate": "user",
"domain": "user",
"id": "string"
},
"sharedWith": {
"aggregate": "user",
"domain": "user",
"id": "string"
},
"title": "string"
}
{
"properties": {
"categoryId": {
"type": "string"
},
"mainUserId": {
"format": "uuid",
"type": "string"
},
"messageContent": {
"maxLength": 8000,
"type": "string"
},
"notificationRoles": {
"items": {
"enum": [
"customer_owner",
"customer_accountant",
"customer_member",
"project_owner",
"project_emailadmin",
"project_external"
],
"type": "string"
},
"type": "array"
},
"relatedTo": {
"oneOf": [
{
"properties": {
"aggregate": {
"enum": [
"user"
],
"type": "string"
},
"domain": {
"enum": [
"user"
],
"type": "string"
},
"id": {
"type": "string"
}
},
"required": [
"id",
"aggregate",
"domain"
],
"type": "object"
},
{
"properties": {
"aggregate": {
"enum": [
"customer"
],
"type": "string"
},
"domain": {
"enum": [
"customer"
],
"type": "string"
},
"id": {
"type": "string"
}
},
"required": [
"id",
"aggregate",
"domain"
],
"type": "object"
},
{
"properties": {
"aggregate": {
"enum": [
"project"
],
"type": "string"
},
"domain": {
"enum": [
"project"
],
"type": "string"
},
"id": {
"type": "string"
}
},
"required": [
"id",
"aggregate",
"domain"
],
"type": "object"
},
{
"properties": {
"aggregate": {
"enum": [
"appinstallation"
],
"type": "string"
},
"domain": {
"enum": [
"app"
],
"type": "string"
},
"id": {
"type": "string"
}
},
"required": [
"id",
"aggregate",
"domain"
],
"type": "object"
},
{
"properties": {
"aggregate": {
"enum": [
"placementgroup"
],
"type": "string"
},
"domain": {
"enum": [
"project"
],
"type": "string"
},
"id": {
"type": "string"
}
},
"required": [
"id",
"aggregate",
"domain"
],
"type": "object"
},
{
"properties": {
"aggregate": {
"enum": [
"extensionInstance"
],
"type": "string"
},
"domain": {
"enum": [
"extension"
],
"type": "string"
},
"id": {
"type": "string"
}
},
"required": [
"id",
"aggregate",
"domain"
],
"type": "object"
},
{
"properties": {
"aggregate": {
"enum": [
"container"
],
"type": "string"
},
"domain": {
"enum": [
"container"
],
"type": "string"
},
"id": {
"type": "string"
}
},
"required": [
"id",
"aggregate",
"domain"
],
"type": "object"
}
]
},
"sharedWith": {
"oneOf": [
{
"properties": {
"aggregate": {
"enum": [
"user"
],
"type": "string"
},
"domain": {
"enum": [
"user"
],
"type": "string"
},
"id": {
"type": "string"
}
},
"required": [
"id",
"aggregate",
"domain"
],
"type": "object"
},
{
"properties": {
"aggregate": {
"enum": [
"customer"
],
"type": "string"
},
"domain": {
"enum": [
"customer"
],
"type": "string"
},
"id": {
"type": "string"
}
},
"required": [
"id",
"aggregate",
"domain"
],
"type": "object"
},
{
"properties": {
"aggregate": {
"enum": [
"project"
],
"type": "string"
},
"domain": {
"enum": [
"project"
],
"type": "string"
},
"id": {
"type": "string"
}
},
"required": [
"id",
"aggregate",
"domain"
],
"type": "object"
},
{
"properties": {
"aggregate": {
"enum": [
"placementgroup"
],
"type": "string"
},
"domain": {
"enum": [
"project"
],
"type": "string"
},
"id": {
"type": "string"
}
},
"required": [
"id",
"aggregate",
"domain"
],
"type": "object"
}
]
},
"title": {
"type": "string"
}
},
"type": "object"
}
Responses
Format
application/json
Beschreibung
- conversationIdstring (uuid)required
Content-Type: application/json
{
"conversationId": "f0f86186-0a5a-45b2-aa33-502777496347"
}
{
"properties": {
"conversationId": {
"format": "uuid",
"type": "string"
}
},
"required": [
"conversationId"
],
"type": "object"
}
Format
application/json
Beschreibung
Validation Error caused by invalid input data in the request
- type"ValidationError"required
- messagestring
- validationErrorsArray von objectrequired
- Array[
- *object
- messagestringrequired
The standard error message
- pathstringrequired
The path to the part of the data that was validated. JavaScript property access notation (e.g., ".prop[1].subProp") is used.
- typestringrequired
ajv validation error type (e.g. "format", "required", "type") or own validation error types
- contextobject
The object with the additional information about the error that can be used to create custom error messages. Keys depend on the type that failed validation (e.g. "missingProperty" for type "required")
- *string
]
Content-Type: application/json
{
"type": "ValidationError",
"message": "Validation failed",
"validationErrors": [
{
"message": "should be string",
"path": ".address.street",
"type": "format",
"context": {
"format": "email"
}
}
]
}
{
"type": "object",
"required": [
"type",
"validationErrors"
],
"properties": {
"type": {
"type": "string",
"enum": [
"ValidationError"
]
},
"message": {
"type": "string",
"example": "Validation failed"
},
"validationErrors": {
"type": "array",
"items": {
"type": "object",
"required": [
"message",
"path",
"type"
],
"properties": {
"message": {
"type": "string",
"description": "The standard error message",
"example": "should be string"
},
"path": {
"type": "string",
"description": "The path to the part of the data that was validated. JavaScript property access notation (e.g., \".prop[1].subProp\") is used.\n",
"example": ".address.street"
},
"type": {
"type": "string",
"description": "ajv validation error type (e.g. \"format\", \"required\", \"type\") or own validation error types",
"example": "format"
},
"context": {
"type": "object",
"example": {
"format": "email"
},
"description": "The object with the additional information about the error that can be used to create custom error messages. Keys depend on the\ntype that failed validation (e.g. \"missingProperty\" for type \"required\")\n",
"additionalProperties": {
"type": "string"
}
}
}
}
}
}
}
Format
application/json
Beschreibung
Your request ran into a rate limit. You have to wait until rate limit expires
- messagestring
- typestring
Content-Type: application/json
{
"message": "too many requests",
"type": "RateLimitError"
}
{
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "too many requests"
},
"type": {
"type": "string",
"example": "RateLimitError"
}
}
}
Format
application/json
Beschreibung
An unexpected Error that occurred while handling the request
- messagestringrequired
- typestringrequired
Content-Type: application/json
{
"message": "Something went wrong",
"type": "InternalServerError"
}
{
"type": "object",
"required": [
"type",
"message"
],
"properties": {
"message": {
"type": "string",
"example": "Something went wrong"
},
"type": {
"type": "string",
"example": "InternalServerError"
}
}
}
Nutzungsbeispiele
$ curl \
--fail \
--location \
-X POST \
-d '{"categoryId":"string","mainUserId":"f0f86186-0a5a-45b2-aa33-502777496347","messageContent":"string","notificationRoles":["customer_owner"],"relatedTo":{"aggregate":"user","domain":"user","id":"string"},"sharedWith":{"aggregate":"user","domain":"user","id":"string"},"title":"string"}' \
-H "Authorization: Bearer $MITTWALD_API_TOKEN" \
-H 'Content-Type: application/json' \
https://api.mittwald.de/v2/conversations
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.conversation.createConversation({
"data": {
"categoryId": "string",
"mainUserId": "f0f86186-0a5a-45b2-aa33-502777496347",
"messageContent": "string",
"notificationRoles": [
"customer_owner"
],
"relatedTo": {
"aggregate": "user",
"domain": "user",
"id": "string"
},
"sharedWith": {
"aggregate": "user",
"domain": "user",
"id": "string"
},
"title": "string"
}
});
assertStatus(response, 201);
use \Mittwald\ApiClient\Generated\V2\Clients\Conversation\CreateConversation\CreateConversationRequest;
use \Mittwald\ApiClient\Generated\V2\Clients\Conversation\CreateConversation\CreateConversationRequestBody;
$client = MittwaldAPIClient::newWithToken(getenv('MITTWALD_API_TOKEN'));
// TODO: Please consult the properties and constructor signature of
// CreateConversationRequestBody to learn how to construct a valid instance
$body = new CreateConversationRequestBody(/* TODO: ... */);
$request = (new CreateConversationRequest(
body: $body
));
$response = $client->conversation()->createConversation($request);
var_dump($response->getBody();