- API-Referenz
- Projekt
- Request a Server avatar upload
Request a Server avatar upload
POST/v2/servers/{serverId}/avatar
API-Version
v2
Request-Methode
POST
Operation-ID
project-request-server-avatar-upload
Request
- serverIdstringrequired
ID of the Server to request an avatar upload for.
Responses
Format
application/json
Beschreibung
OK
- refIdstring (uuid)required
- rulesobjectrequired
- maxSizeInKBinteger (int64)required
- mimeTypesArray von stringrequired
- Array[
- *string
]
- propertiesobject
- imageDimensionsobject
- maxobject
- heightinteger (int64)
- widthinteger (int64)
- minobject
- heightinteger (int64)
- widthinteger (int64)
Content-Type: application/json
{
"refId": "f0f86186-0a5a-45b2-aa33-502777496347",
"rules": {
"maxSizeInKB": 3000,
"mimeTypes": [
"image/jpeg",
"image/png"
],
"properties": {
"imageDimensions": {
"max": {
"height": 123,
"width": 123
},
"min": {
"height": 123,
"width": 123
}
}
}
}
}
{
"properties": {
"refId": {
"format": "uuid",
"type": "string"
},
"rules": {
"properties": {
"maxSizeInKB": {
"example": 3000,
"format": "int64",
"type": "integer"
},
"mimeTypes": {
"example": [
"image/jpeg",
"image/png"
],
"items": {
"type": "string"
},
"type": "array"
},
"properties": {
"properties": {
"imageDimensions": {
"properties": {
"max": {
"properties": {
"height": {
"format": "int64",
"type": "integer"
},
"width": {
"format": "int64",
"type": "integer"
}
},
"type": "object"
},
"min": {
"properties": {
"height": {
"format": "int64",
"type": "integer"
},
"width": {
"format": "int64",
"type": "integer"
}
},
"type": "object"
}
},
"type": "object"
}
},
"type": "object"
}
},
"required": [
"mimeTypes",
"maxSizeInKB"
],
"type": "object"
}
},
"required": [
"refId",
"rules"
],
"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
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"
}
}
}
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 \
-H "Authorization: Bearer $MITTWALD_API_TOKEN" \
https://api.mittwald.de/v2/servers/string/avatar
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.requestServerAvatarUpload({
"serverId": "string"
});
assertStatus(response, 200);
use \Mittwald\ApiClient\Generated\V2\Clients\Project\RequestServerAvatarUpload\RequestServerAvatarUploadRequest;
$client = MittwaldAPIClient::newWithToken(getenv('MITTWALD_API_TOKEN'));
$request = (new RequestServerAvatarUploadRequest(
serverId: "string"
));
$response = $client->project()->requestServerAvatarUpload($request);
var_dump($response->getBody();