Skip to content

Latest commit

 

History

History
292 lines (225 loc) · 8.99 KB

NftStorageApi.md

File metadata and controls

292 lines (225 loc) · 8.99 KB

NftStorageApi

All URIs are relative to https://api.nft.storage

Method HTTP request Description
delete DELETE /{cid} Stop storing the content with the passed CID
list GET / List all stored files
status GET /{cid} Get information for the stored file CID
store POST /upload Store a file

delete

DeleteResponse delete(cid)

Stop storing the content with the passed CID

Stop storing the content with the passed CID on nft.storage. - Unpin the item from the underlying IPFS pinning service. - Cease renewals for expired Filecoin deals involving the CID. ⚠️ This does not remove the content from the network. - Does not terminate any established Filecoin deal. - Does not remove the content from other IPFS nodes in the network that already cached or pinned the CID. Note: the content will remain available if another user has stored the CID with nft.storage.

Example

// Import classes:
import storage.nft.ApiClient;
import storage.nft.ApiException;
import storage.nft.Configuration;
import storage.nft.auth.*;
import storage.nft.models.*;
import storage.nft.api.NftStorageApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.nft.storage");
    
    // Configure HTTP bearer authorization: bearerAuth
    HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth");
    bearerAuth.setBearerToken("BEARER TOKEN");

    NftStorageApi apiInstance = new NftStorageApi(defaultClient);
    String cid = "cid_example"; // String | CID for the NFT
    try {
      DeleteResponse result = apiInstance.delete(cid);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling NftStorageApi#delete");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
cid String CID for the NFT

Return type

DeleteResponse

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -
401 Unauthorized -
403 Forbidden -
5XX Internal Server Error -

list

ListResponse list(before, limit)

List all stored files

Example

// Import classes:
import storage.nft.ApiClient;
import storage.nft.ApiException;
import storage.nft.Configuration;
import storage.nft.auth.*;
import storage.nft.models.*;
import storage.nft.api.NftStorageApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.nft.storage");
    
    // Configure HTTP bearer authorization: bearerAuth
    HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth");
    bearerAuth.setBearerToken("BEARER TOKEN");

    NftStorageApi apiInstance = new NftStorageApi(defaultClient);
    OffsetDateTime before = OffsetDateTime.now(); // OffsetDateTime | Return results created before provided timestamp
    Integer limit = 10; // Integer | Max records to return
    try {
      ListResponse result = apiInstance.list(before, limit);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling NftStorageApi#list");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
before OffsetDateTime Return results created before provided timestamp [optional]
limit Integer Max records to return [optional] [default to 10]

Return type

ListResponse

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -
401 Unauthorized -
403 Forbidden -
5XX Internal Server Error -

status

GetResponse status(cid)

Get information for the stored file CID

Includes the IPFS pinning state and the Filecoin deal state.

Example

// Import classes:
import storage.nft.ApiClient;
import storage.nft.ApiException;
import storage.nft.Configuration;
import storage.nft.auth.*;
import storage.nft.models.*;
import storage.nft.api.NftStorageApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.nft.storage");
    
    // Configure HTTP bearer authorization: bearerAuth
    HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth");
    bearerAuth.setBearerToken("BEARER TOKEN");

    NftStorageApi apiInstance = new NftStorageApi(defaultClient);
    String cid = "cid_example"; // String | CID for the NFT
    try {
      GetResponse result = apiInstance.status(cid);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling NftStorageApi#status");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
cid String CID for the NFT

Return type

GetResponse

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -
401 Unauthorized -
403 Forbidden -
5XX Internal Server Error -

store

UploadResponse store(body)

Store a file

Store a file with nft.storage. - Submit a HTTP `POST` request passing the file data in the request body. - To store multiple files in a directory, submit a `multipart/form-data` HTTP `POST` request. Use the `Content-Disposition` header for each part to specify a filename.

Example

// Import classes:
import storage.nft.ApiClient;
import storage.nft.ApiException;
import storage.nft.Configuration;
import storage.nft.auth.*;
import storage.nft.models.*;
import storage.nft.api.NftStorageApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.nft.storage");
    
    // Configure HTTP bearer authorization: bearerAuth
    HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth");
    bearerAuth.setBearerToken("BEARER TOKEN");

    NftStorageApi apiInstance = new NftStorageApi(defaultClient);
    File body = new File("/path/to/file"); // File | 
    try {
      UploadResponse result = apiInstance.store(body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling NftStorageApi#store");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
body File

Return type

UploadResponse

Authorization

bearerAuth

HTTP request headers

  • Content-Type: image/png, application/octet-stream, multipart/form-data
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -
401 Unauthorized -
403 Forbidden -
5XX Internal Server Error -