improved

27 February 2024 - Token-type Creation Update

Update on a breaking change for the NFT-API v2.0, specifically for the token-type creation endpoint.

Updated Token-type creation request/response

Previously when creating a token-type, we passed an array in the request body. This method of creating a token-type will not work anymore as the request body is to be passed as an object.

Please look at the following examples where we compare the old way of creating a token-type (request body as an array) and the updated method where the request body is passed as an object.

Old method of creating a token-type

Request

🚧

The old method to create a token-type included passing the request body as an array.

 POST /api/v2/token-types/creations
[
    {
    "name": "My first NFT",
    "description": "Venly",
    "image": "https://storage-qa.venly.io/applications/1f64ded9-2a05-4824-b682-661023359357/StickFigureHi.png",
    "secretType": "MATIC",
    "contractAddress": "0x30d6cff9cb268c59c75a94755b2c60e118d65657"
    }
]

Response Body

{
    "success": true,
    "result": [
        {
            "id": "00b4e819-05f5-4ed5-a775-584210c33c01",
            "status": "PENDING",
            "tokenTypeId": 1,
            "metadata": {
                "name": "My first NFT",
                "description": "Venly",
                "image": "https://storage-qa.venly.io/applications/1f64ded9-2a05-4824-b682-661023359357/StickFigureHi.png",
                "imagePreview": "https://storage-qa.venly.io/applications/1f64ded9-2a05-4824-b682-661023359357/StickFigureHi.png",
                "imageThumbnail": "https://storage-qa.venly.io/applications/1f64ded9-2a05-4824-b682-661023359357/StickFigureHi.png",
                "animationUrls": [],
                "attributes": [
                    {
                        "type": "system",
                        "name": "tokenTypeId",
                        "value": "1",
                        "traitType": "Token Type ID",
                        "trait_type": "Token Type ID"
                    }
                ],
                "contract": {
                    "address": "0x30d6cff9cb268c59c75a94755b2c60e118d65657",
                    "name": "My first collection",
                    "symbol": "MYFICO",
                    "image": "https://pbs.twimg.com/profile_images/1669300450649157635/4xg-wsbK_400x400.jpg",
                    "imageUrl": "https://pbs.twimg.com/profile_images/1669300450649157635/4xg-wsbK_400x400.jpg",
                    "image_url": "https://pbs.twimg.com/profile_images/1669300450649157635/4xg-wsbK_400x400.jpg",
                    "description": "Sample description",
                    "externalLink": "www.venly.io",
                    "external_link": "www.venly.io",
                    "externalUrl": "www.venly.io",
                    "external_url": "www.venly.io",
                    "media": [],
                    "type": "ERC_1155"
                },
                "fungible": false
            }
        }
    ]
}

Updated method of creating token-type

This example includes the updated request body (as an object) for creating a token-type and an updated response body.

The request body now includes a new array of objects called creations which includes information on a token-type. The creations array can include one or multiple token-type details, which means you can create one or multiple token-types with a single request.

When creating multiple token-types you can define them individually as objects within the creations array.

Request Endpoint: reference

 POST /api/v2/token-types/creations

Request Body:

ParameterDescriptionTypeRequired
secretTypeThe blockchain of the contractString
contractAddressThe contract address under which you want to create the token-typeString
creationsAn array of objects that can define one or multiple token-type detailsArray of objects
creations.nameThe name of the token-typeString
creations.descriptionThe description of the token-typeString
creations.imageThe image URL for the token-type that will be displayedString

📘

  • The request body is an object.
  • The token-type details are passed in the creations array as object.
{
  "secretType": "MATIC",
  "contractAddress": "0xf5b11b4f458cc12a7989a146c5db2e7d500e2241",
  "creations": [
    {
      "name": "My first NFT Token-type",
      "description": "Venly",
      "image": "https://storage-qa.venly.io/applications/1f64ded9-2a05-4824-b682-661023359357/StickFigureHi.png"
    }
  ]
}

Response Body:

📘

  • Save the result.creations.id from the response body. This is the token-type Creation ID and it's used to track the status of the token-type creation request.
  • The status attribute indicates the token-type creation status.
  • The result is now an object with an array of creations.
{
  "success": true,
  "result": {
    "creations": [
      {
        "id": "45cf858a-cb0d-4e31-b6e1-b3bf4c65d014",
        "status": "PENDING",
        "tokenTypeId": 5,
        "metadata": {
          "name": "My first NFT Token-type",
          "description": "Venly",
          "image": "https://storage-qa.venly.io/applications/1f64ded9-2a05-4824-b682-661023359357/StickFigureHi.png",
          "imagePreview": "https://storage-qa.venly.io/applications/1f64ded9-2a05-4824-b682-661023359357/StickFigureHi.png",
          "imageThumbnail": "https://storage-qa.venly.io/applications/1f64ded9-2a05-4824-b682-661023359357/StickFigureHi.png",
          "animationUrls": [],
          "attributes": [
            {
              "type": "system",
              "name": "tokenTypeId",
              "value": "5",
              "traitType": "Token Type ID",
              "trait_type": "Token Type ID"
            }
          ],
          "contract": {
            "address": "0xf5b11b4f458cc12a7989a146c5db2e7d500e2241",
            "name": "Test",
            "symbol": "TE",
            "image": "string",
            "imageUrl": "string",
            "image_url": "string",
            "description": "Testing",
            "externalLink": "www.venly.io",
            "external_link": "www.venly.io",
            "externalUrl": "www.venly.io",
            "external_url": "www.venly.io",
            "media": [],
            "type": "ERC_1155"
          },
          "fungible": false
        }
      }
    ]
  }
}