API: Submission of a Product / Item (WIP/DRAFT!)

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

Variables

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

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

Media preparation

In order to associate a product with certain media files, we must first prepare these media files before the product itself is created with them. For the sake of completeness, the reverse way would also work: first create a product without media files and add the media files later.

This process is covered in the following document: (TODO Link).

The request: creating the product resource

Request:

Authorization
None

Method

POST

Endpoint

{{API_URL_SHOP}}/products

Request Code (Success)

204 - No Content

Response Body

(empty)

Request Body for a minimal version of a product:

{
  "mediaFiles": [
    {
      "mediaType": "gallery",
      "fileName": "patmat-6c4126dc77ec49fd9988eff2d67cd71d.png",
      "bucket": "tf-test-uploader"
    }
  ],
  "translations": {
    "de": {
      "name": "api-test {{$randomFoodImage}} {{$randomUUID}}",
      "locale": "de",
      "description": "test {{$randomPhrase}}-{{$randomPhoneNumber}}"
    }
  }
}

Request Body for the full version of a product:

{
  "mediaFiles": [
    {
      "mediaType": "gallery",
      "fileName": "patmat-6c4126dc77ec49fd9988eff2d67cd71d.png",
      "bucket": "tf-test-uploader"
    }
  ],
  "royalties": "0.99",
  "whitelisting": {
      "field": 1,
      "field2": 2 
  },
  "mainTaxon": "/api/v2/shop/taxons/music",
  "metadata": {
      "display_type": "number",
      "trait_type": "strength",
      "value": 2,
      "max_value": 10
  },
  "mintingStartAt": "2022-05-02 00:00:00",
  "mintingEndAt": "2022-05-03 12:30:00",
  "translations": {
    "de": {
      "name": "{{titleDE}}",
      "locale": "de",
      "description": "{{descrDE}}"
    },
    "en": {
      "name": "{{titleEN}}",
      "locale": "en",
      "description": "{{descrEN}}"
    }
  }
}

Last updated