Zum Hauptinhalt springen

Request a new avatar image upload

POST/v2/users/{userId}/avatar
API-Version
v2
Request-Methode
POST
Operation-ID
user-request-avatar-upload

Request​

  • userIdstringrequired

    self or the id of a user.

Responses​

Format
application/json
Beschreibung

Avatar upload request was successful.

  • refIdstring (uuid)required

    The refId to be used to upload your avatar to the /v2/files/:refId route.

  • rulesobjectrequired

    Contstraints for the avatar image upload.

    • maxSizeInBytesintegerrequired

      Maximum size in Bytes of the avatar image.

    • maxSizeInKBintegerdeprecatedrequired

      Deprecated. Maximum size in kilobytes of the avatar image.

    • mimeTypesArray von stringrequired

      List of supported mime types.

      • Array[
        • *string
        ]
    • propertiesobject
      • imageDimensionsobject

        Supported range of dimensions for the avatar image.

        • maxobject
          • heightinteger
          • widthinteger
        • minobject
          • heightinteger
          • widthinteger
Content-Type: application/json

{
"refId": "f0f86186-0a5a-45b2-aa33-502777496347",
"rules": {
"maxSizeInBytes": 4096,
"mimeTypes": [
"image/png"
],
"properties": {
"imageDimensions": {
"max": {
"height": 123,
"width": 123
},
"min": {
"height": 123,
"width": 123
}
}
}
}
}
{
"properties": {
"refId": {
"description": "The `refId` to be used to upload your avatar to the /v2/files/:refId route.",
"format": "uuid",
"type": "string"
},
"rules": {
"description": "Contstraints for the avatar image upload.",
"properties": {
"maxSizeInBytes": {
"description": "Maximum size in Bytes of the avatar image.",
"example": 4096,
"type": "integer"
},
"maxSizeInKB": {
"deprecated": true,
"description": "Deprecated. Maximum size in kilobytes of the avatar image.",
"example": 3000,
"type": "integer"
},
"mimeTypes": {
"description": "List of supported mime types.",
"items": {
"example": "image/png",
"type": "string"
},
"type": "array"
},
"properties": {
"properties": {
"imageDimensions": {
"description": "Supported range of dimensions for the avatar image.",
"properties": {
"max": {
"properties": {
"height": {
"type": "integer"
},
"width": {
"type": "integer"
}
},
"type": "object"
},
"min": {
"properties": {
"height": {
"type": "integer"
},
"width": {
"type": "integer"
}
},
"type": "object"
}
},
"type": "object"
}
},
"type": "object"
}
},
"required": [
"mimeTypes",
"maxSizeInKB",
"maxSizeInBytes"
],
"type": "object"
}
},
"required": [
"refId",
"rules"
],
"type": "object"
}

Nutzungsbeispiele​

$ curl \
--fail \
--location \
-X POST \
-d '{}' \
-H "Authorization: Bearer $MITTWALD_API_TOKEN" \
-H 'Content-Type: application/json' \
https://api.mittwald.de/v2/users/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.user.requestAvatarUpload({
"userId": "string",
"data": {}
});

assertStatus(response, 200);

use \Mittwald\ApiClient\Generated\V2\Clients\User\RequestAvatarUpload\RequestAvatarUploadRequest;
use \Mittwald\ApiClient\Generated\V2\Clients\User\RequestAvatarUpload\RequestAvatarUploadRequestBody;

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

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

$request = (new RequestAvatarUploadRequest(
userId: "string",
body: $body
));
$response = $client->user()->requestAvatarUpload($request);

var_dump($response->getBody();

Auf dieser Seite