Skip to main content

Add an asset to an extension

POST/v2/contributors/{contributorId}/extensions/{extensionId}/assets
API version
v2
Request method
POST
Operation ID
extension-request-asset-upload

Request​

  • contributorIdstringrequired
  • extensionIdstring (uuid)required

Responses​

Format
application/json
Description

The Upload of an asset for the extension has been requested.

  • assetRefIdstring (uuid)required

    Use the ID as upload token at /v2/files/{assetRefId}. This ID will also be the ID of your asset in extension.

  • rulesobjectrequired

    Constraints for the asset image or video upload, defers on the given assetType.

    • extensionsarray of stringrequired
      • Array[
        • *string
        ]
    • fileTypesarray of objectrequired
      • Array[
        • *object
          • extensionsarray of stringrequired
            • Array[
              • *string
              ]
          • mimeTypestringrequired
        ]
    • maxSizeInBytesintegerrequired
    • mimeTypesarray of stringrequired
      • Array[
        • *string
        ]
    • propertiesobject
      • imageDimensionsobject
        • maxobjectrequired
          • heightinteger
          • widthinteger
        • minobjectrequired
          • heightinteger
          • widthinteger
Content-Type: application/json

{
"assetRefId": "f0f86186-0a5a-45b2-aa33-502777496347",
"rules": {
"extensions": [
".png"
],
"fileTypes": [
{
"extensions": [
".png"
],
"mimeType": "image/png"
}
],
"maxSizeInBytes": 123,
"mimeTypes": [
"image/png"
],
"properties": {
"imageDimensions": {
"max": {
"height": 123,
"width": 123
},
"min": {
"height": 123,
"width": 123
}
}
}
}
}
{
"properties": {
"assetRefId": {
"description": "Use the ID as upload token at `/v2/files/{assetRefId}`. This ID will also be the ID of your asset in extension.",
"format": "uuid",
"type": "string"
},
"rules": {
"description": "Constraints for the asset image or video upload, defers on the given assetType.",
"properties": {
"extensions": {
"items": {
"example": ".png",
"type": "string"
},
"type": "array"
},
"fileTypes": {
"items": {
"properties": {
"extensions": {
"items": {
"example": ".png",
"type": "string"
},
"type": "array"
},
"mimeType": {
"example": "image/png",
"type": "string"
}
},
"required": [
"mimeType",
"extensions"
],
"type": "object"
},
"type": "array"
},
"maxSizeInBytes": {
"type": "integer"
},
"mimeTypes": {
"items": {
"example": "image/png",
"type": "string"
},
"type": "array"
},
"properties": {
"properties": {
"imageDimensions": {
"properties": {
"max": {
"properties": {
"height": {
"type": "integer"
},
"width": {
"type": "integer"
}
},
"type": "object"
},
"min": {
"properties": {
"height": {
"type": "integer"
},
"width": {
"type": "integer"
}
},
"type": "object"
}
},
"required": [
"min",
"max"
],
"type": "object"
}
},
"type": "object"
}
},
"required": [
"mimeTypes",
"extensions",
"fileTypes",
"maxSizeInBytes"
],
"type": "object"
}
},
"required": [
"assetRefId",
"rules"
],
"type": "object"
}

Usage examples​

$ curl \
--fail \
--location \
-X POST \
-d '{"assetType":"image"}' \
-H "Authorization: Bearer $MITTWALD_API_TOKEN" \
-H 'Content-Type: application/json' \
https://api.mittwald.de/v2/contributors/string/extensions/f0f86186-0a5a-45b2-aa33-502777496347/assets
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.marketplace.extensionRequestAssetUpload({
"contributorId": "string",
"extensionId": "f0f86186-0a5a-45b2-aa33-502777496347",
"data": {
"assetType": "image"
}
});

assertStatus(response, 200);

use \Mittwald\ApiClient\Generated\V2\Clients\Marketplace\ExtensionRequestAssetUpload\ExtensionRequestAssetUploadRequest;
use \Mittwald\ApiClient\Generated\V2\Clients\Marketplace\ExtensionRequestAssetUpload\ExtensionRequestAssetUploadRequestBody;

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

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

$request = (new ExtensionRequestAssetUploadRequest(
contributorId: "string",
extensionId: "f0f86186-0a5a-45b2-aa33-502777496347",
body: $body
));
$response = $client->marketplace()->extensionRequestAssetUpload($request);

var_dump($response->getBody();

On this page