👨‍💻
MYTY
MYTY SDK
MYTY SDK
  • MYTY SDK
  • How to use MYTY SDK?
    • Create Unity Project
    • Import MYTY Kit
    • Import MYTY SDK
    • Build MYTY SDK
    • Create Scene
  • MYTY SDK Interface
    • Load Avatar
    • Select Avatar
    • Choose View Mode
    • Control Avatar (Mediapipe)
    • Control Avatar (ARKit)
  • For Web Application
    • Interacting with browser scripting
    • Integrate with React Project
  • React Example
    • Handle WebGL view & interaction
    • Choose Video Device for input
    • Handle Mediapipe Holistic
    • Capture & Record
  • For iOS Application
    • Interact with native iOS application
    • Integrate with Flutter Project
    • Trouble Shooting (Flutter Integration)
  • Flutter Example
    • Handle UnityWidget & interaction
    • Use ARKit Plugin
  • Avatar Registry(API)
    • Overview
    • Getting Started
    • Auth & Rate Limit
    • Legacy - v0
  • Resources
    • License Agreement
    • Version Note (SDK vs Kit)
    • Display Logo
Powered by GitBook
On this page
  • Getting started
  • Basics Flow
  • Prerequisites
  • Supported NFT Collections
  • Get the information of avatar collection from specific NFT collection
  • Get the asset to render
  1. Avatar Registry(API)

Getting Started

MYTY Avatar Registry provide a REST API.

We're thrilled to announce the release of our new API, version 1. This api has enhanced features for application builder, to leverage our ecosystem. Please read this article, regarding the updates.

Getting started

  1. First of all, you need to request an API key. Please visit Auth & Rate Limit

  2. We have built the playground, you can easily play with our APIs.

Basics Flow

Please use following path: https://api.myty.space/v1

In order to load specific avatars into your applications, please follow the steps.

  1. /nfts Get supported NFT Collections to know collectionAddress

  2. /assets/collections Get the avatarColectionId and metadataAssetUri of specific collection

  3. /assets/ Get the avatar assetUri

Prerequisites

  • Do not forget to get your API Key by contacting us

  • MYTY Rest API utilizes Pageable, please read this doc to have comprehensive understanding.

  • Please refer entity pages for further information of domains and entities.

Supported NFT Collections

Various types of avatar are provided in Avatar Registry. Request following API to get the complete list of supported NFT Collections, which is connected to the avatars. (Contact us at Auth & Rate Limit to get your API Key)

req.

/nfts

res.

{
  "content": [
    {
      "id": 1,
      "chain": "ethereum",
      "address": "0x1f497bcC6332A45dADc53154c80Dce79adcd2E6A",
      "collectionName": "Lil Castaways"
    },
    ...
    ...
    ...
  ],
  "pageable": {
    "sort": {
      "sorted": false,
      "empty": true,
      "unsorted": true
    },
    "pageNumber": 0,
    "pageSize": 20,
    "offset": 0,
    "unpaged": false,
    "paged": true
  },
  "last": true,
  "totalElements": 1,
  "totalPages": 1,
  "first": true,
  "sort": {
    "sorted": false,
    "empty": true,
    "unsorted": true
  },
  "size": 20,
  "number": 0,
  "numberOfElements": 9,
  "empty": false
}

With the above API call, you will be able to identify:

  • NFT Collection supported in MYTY Avatar Registry

  • collectionAddress from .content[.address]

Get the information of avatar collection from specific NFT collection

NFT(nftCollectionAddress) and Avatar Collection is 1:n relationship. For example, if you hold a cryptopunk, you may access to different shape, version of avatars.

You need to identify the number of avatar assets connected to the specific NFT Collection

req.

/assets/collections?chain={chain}&nftCollectionAddress={nftCollectionAddress}

res. (example)

{
  "content": [
    {
      "id": 1,
      "name": "Castaway",
      "creator": {
        "id": 1,
        "address": "0xE6Cd69968D1FcDdddCc7284d3fEBc293B7ea48c6"
      },
      "nftCollection": {
        "id": 1,
        "chain": "ethereum",
        "address": "0x1f497bcC6332A45dADc53154c80Dce79adcd2E6A",
        "collectionName": "Lil Castaways"
      },
      "versions": [
        {
          "id": 4,
          "version": 6,
          "description": "",
          "status": "SUBMITTED",
          "kitVersion": {
            "id": 1,
            "major": 1,
            "minor": 2,
            "patch": 0
          },
          "assetUri": "https://assets-avatar-dev.myty.space/assets/Castaway/6/collection_mas_metadata.zip",
          "tags": []
        },
        {
          "id": 3,
          "version": 4,
          "description": "",
          "status": "SUBMITTED",
          "kitVersion": {
            "id": 1,
            "major": 1,
            "minor": 2,
            "patch": 0
          },
          "assetUri": "https://assets-avatar-dev.myty.space/assets/Castaway/4/collection_mas_metadata.zip",
          "tags": []
        }
        
        ...
        
      ],
      "createdAt": "2023-04-10T06:15:14.935295",
      "updatedAt": "2023-04-10T06:15:14.935305",
      "expiredAt": null,
      "isOfficial": false,
      "createdBy": null,
      "updatedBy": null
    }
  ],
  "pageable": {
    "sort": {
      "sorted": false,
      "unsorted": true,
      "empty": true
    },
    "pageNumber": 0,
    "pageSize": 20,
    "offset": 0,
    "paged": true,
    "unpaged": false
  },
  "last": true,
  "totalElements": 1,
  "totalPages": 1,
  "sort": {
    "sorted": false,
    "unsorted": true,
    "empty": true
  },
  "first": true,
  "number": 0,
  "numberOfElements": 1,
  "size": 20,
  "empty": false
}

In this example, you can check that

  • ID of avatar collection : .content[.id]

  • The version of avatar assets (auto incremental)

  • MYTY Kit version

  • and, MetaDataAssetUri from assetUri

Get the asset to render

Now it's time to download asset to render and show to your user. I assume that you have

  • nftCollectionAddress is connected(1:N) to the avatar asset

  • avatarCollectionId is ID of avatar collection

  • version : specific version of your avatar asset

  • importantly, tokenIds : you want to render or load

req.

/assets
    ?chain=ethereum
    &nftCollectionAddress={nftCollectionAddress}
    &collectionId={avatarCollectionId}
    &version={version}
    &tokenIds={tokenId,tokendId,tokenId}

res.

{
  "content": [
    {
      "id": "be425eef-607a-4367-ba56-cd4f9d11a58f",
      "tokenId": "9020",
      "assetUri": "https://assets-avatar-dev.myty.space/assets/Castaway/2/9020.zip",
      "tags": []
    },
    {
      "id": "abcfd9ca-6ab4-4e8a-bf5b-3908f85f334b",
      "tokenId": "9021",
      "assetUri": "https://assets-avatar-dev.myty.space/assets/Castaway/2/9021.zip",
      "tags": []
    },
    {
      "id": "96656bf4-b7db-4fbe-a17c-222fe3dcc00d",
      "tokenId": "9022",
      "assetUri": "https://assets-avatar-dev.myty.space/assets/Castaway/2/9022.zip",
      "tags": []
    }
  ],
  "pageable": {
    "sort": {
      "sorted": false,
      "empty": true,
      "unsorted": true
    },
    "pageNumber": 0,
    "pageSize": 20,
    "offset": 0,
    "unpaged": false,
    "paged": true
  },
  "last": true,
  "totalElements": 3,
  "totalPages": 1,
  "first": true,
  "sort": {
    "sorted": false,
    "empty": true,
    "unsorted": true
  },
  "size": 20,
  "number": 0,
  "numberOfElements": 3,
  "empty": false
}

Ta-da!

Now, combine metadata and assetUri for specific token, then your avatar will be rendered.

PreviousOverviewNextAuth & Rate Limit

Last updated 2 years ago