Getting started

This tutorial will help you make your first API call to receive a list of NFT tokens in the CSPR.studio contract.

Prerequisites

We will use cURL to make API calls. You can install it from the curl.se website or by using the package manager of your choice.

Request access token

Please leave your access request at the CSPR.cloud website if you haven't done it yet. Once we review it, we'll send you an email with your access token. Keep an eye on your inbox.

While waiting, you can play with the API using the demo access token 55f79117-fc4d-4d60-9956-65423f39a06a. Note, that it's a shared token and it can drain its rate limit and quotas quickly.

First API call

To fetch the NFT tokens in the CSPR.studio contract we'll be using the NFT API. The endpoint requires a contract package hash, which we can find on CSPR.live:

curl -X 'GET' \
  'https://api.cspr.cloud/contract-packages/c4e5a03066ce3c6006f562939e48f7076c77de5d46cf8fe625c41e02c5e74814/nft-tokens' \
  -H 'accept: application/json' \
  -H 'authorization: [Your access token]'
{
  "data": [
    {
      "contract_package_hash": "c4e5a03066ce3c6006f562939e48f7076c77de5d46cf8fe625c41e02c5e74814",
      "is_burned": false,
      "offchain_metadata": null,
      "offchain_metadata_status": 0,
      "onchain_metadata": {
        "asset": "https://maritime.sealstorage.io/make/c4e5a03066ce3c60/0a14a18a7a214b64a9da1e5bdfe12ded",
        "description": "Friday morning in Рíвне.",
        "name": "Friday morning in Rivne"
      },
      "owner_hash": "8297d55f4530ac75f46d04319bf4c7d1de68de1b3fe31cd462f752fadf27b571",
      "owner_type": 0,
      "timestamp": "2022-10-31T07:20:42Z",
      "token_id": "1",
      "token_standard_id": 1,
      "tracking_id": 6053
    },
    {
      "contract_package_hash": "c4e5a03066ce3c6006f562939e48f7076c77de5d46cf8fe625c41e02c5e74814",
      "is_burned": false,
      "offchain_metadata": null,
      "offchain_metadata_status": 0,
      "onchain_metadata": {
        "asset": "https://maritime.sealstorage.io/make/c4e5a03066ce3c60/69a349373da14f6f9511e2a8d375657e",
        "description": "Dougal loving life on the edge",
        "name": "Flying Dougal"
      },
      "owner_hash": "2af66211f9fb970ead08bb80d3d05ad385f83e51caf4940c2f2eb309a0427828",
      "owner_type": 0,
      "timestamp": "2022-11-15T16:54:36Z",
      "token_id": "10",
      "token_standard_id": 1,
      "tracking_id": 11228
    },
    ...
    {
      "contract_package_hash": "c4e5a03066ce3c6006f562939e48f7076c77de5d46cf8fe625c41e02c5e74814",
      "is_burned": false,
      "offchain_metadata": null,
      "offchain_metadata_status": 0,
      "onchain_metadata": {
        "asset": "https://maritime.sealstorage.io/ipfs/bafybeif6wojygvwuav4wdt7dyqx2ekem4fqdpx47p3fu2e5yh7y6anqr2u",
        "description": "The “Ghost” collection is a unique serie of NFTs found on the Casper blockchain. These NFTs are digital representations of ghosts, spirits, and paranormal phenomenon that have been meticulously designed and created by digital artists. Each NFT in this collection is a unique and exclusive piece that captures the essence of the supernatural and the mysterious.\n",
        "name": "Ghosts"
      },
      "owner_hash": "a485e8c7fbe2bfd939930dd9d94025b403fe4bfcf0f8f46b31bd9f28298b8890",
      "owner_type": 0,
      "timestamp": "2023-10-07T08:31:23Z",
      "token_id": "1006",
      "token_standard_id": 1,
      "tracking_id": 317986
    }
  ],
  "item_count": 1277,
  "page_count": 128
}

Replace "[Your-Access-Token]" with your actual access token in each example.

What's next

Please proceed with the following documents to get familiar with CSPR.cloud:

  • Overview Learn about the general technical aspects of CSPR.cloud API, and how it works

  • Highlights Learn about CSPR.cloud API possibilities, which aren't present in the Casper Node RPC API

  • REST API Get familiar with the REST API reference to know what endpoints are available

  • Streaming API Get familiar with the Streaming API reference to know what Web Socket subscriptions are available

  • Casper Node API Learn how to connect to the private Casper Node powered by CSPR.cloud using the most popular SDKs

  • CSPR.click While CSPR.cloud handles your dApp integration with the Casper Network, CSPR.click takes care of how users of your dApp interact with the blockchain. It provides integration with all the wallets and on-ramp providers in the Casper ecosystem to solve authentication and token-acquiring problems. Please be sure to check it out!

Last updated