API: Prepare an Image for Uploading

Prerequisites

In order to perform the sign up of a customer, you should have read our introduction on how our API is built and what basic concepts have been applied:

Principles of the API

TokenForge MediaService

We assume that we will initially use AWS S3 as storage in conjunction with TokenForge MediaService.

Variables

Throughout our tutorials, we will use Variables which are also part of our Postman collections:

{{IMAGEPROXY_HOST}} : this covers the whole URL of the REST-API including the suffix for “shop”-related endpoints

{{IMAGEPROXY_HOST}} : this variable contains the whole URL of the MediaService related REST-API.

The request: prepare a pre-signed URL

Authorization
None

Method

POST

Endpoint

{{IMAGEPROXY_HOST}}/prepare/$bucketName/$filename

Request Body

empty

Request Code (Success)

200

Response Body

{ "url": ""https://tf-test-uploader.s3.eu-central-1.amazonaws.com/my-fancy-picture-168ed648d1ce47449fbcd9bad2474769.jpg?X-Amz-Algorithm=AWS4-....", "filename": "my-fancy-picture-168ed648d1ce47449fbcd9bad2474769.jpg", "method": "PUT", "signed_header": { "host": "tf-bucket.s3.eu-central-1.amazonaws.com" } }

Error Response Codes

401 - Unauthorized

Restrictions:

  • The bucket must be created first and should be accessible to the current AWS user

  • The filename can be pre-defined by the frontend. However, the backend will sanitize the filename and add its own salt with figures. The resulting filename will be part of the response.

Last updated