All URIs are relative to https://api.nft.storage.
Method | HTTP request | Description |
---|---|---|
callList() | GET / | List all stored files |
delete() | DELETE /{cid} | Stop storing the content with the passed CID |
status() | GET /{cid} | Get information for the stored file CID |
store() | POST /upload | Store a file |
callList($before, $limit): \NFTStorage\Model\ListResponse
List all stored files
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure Bearer (JWT) authorization: bearerAuth
$config = NFTStorage\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new NFTStorage\Api\NFTStorageAPI(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$before = 2020-07-27T17:32:28Z; // \DateTime | Return results created before provided timestamp
$limit = 10; // int | Max records to return
try {
$result = $apiInstance->callList($before, $limit);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling NFTStorageAPI->callList: ', $e->getMessage(), PHP_EOL;
}
Name | Type | Description | Notes |
---|---|---|---|
before | \DateTime | Return results created before provided timestamp | [optional] |
limit | int | Max records to return | [optional] [default to 10] |
\NFTStorage\Model\ListResponse
- Content-Type: Not defined
- Accept:
application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
delete($cid): \NFTStorage\Model\DeleteResponse
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.
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure Bearer (JWT) authorization: bearerAuth
$config = NFTStorage\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new NFTStorage\Api\NFTStorageAPI(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$cid = 'cid_example'; // string | CID for the NFT
try {
$result = $apiInstance->delete($cid);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling NFTStorageAPI->delete: ', $e->getMessage(), PHP_EOL;
}
Name | Type | Description | Notes |
---|---|---|---|
cid | string | CID for the NFT |
\NFTStorage\Model\DeleteResponse
- Content-Type: Not defined
- Accept:
application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
status($cid): \NFTStorage\Model\GetResponse
Get information for the stored file CID
Includes the IPFS pinning state and the Filecoin deal state.
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure Bearer (JWT) authorization: bearerAuth
$config = NFTStorage\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new NFTStorage\Api\NFTStorageAPI(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$cid = 'cid_example'; // string | CID for the NFT
try {
$result = $apiInstance->status($cid);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling NFTStorageAPI->status: ', $e->getMessage(), PHP_EOL;
}
Name | Type | Description | Notes |
---|---|---|---|
cid | string | CID for the NFT |
- Content-Type: Not defined
- Accept:
application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
store($body): \NFTStorage\Model\UploadResponse
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.
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure Bearer (JWT) authorization: bearerAuth
$config = NFTStorage\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new NFTStorage\Api\NFTStorageAPI(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$body = "/path/to/file.txt"; // \SplFileObject
try {
$result = $apiInstance->store($body);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling NFTStorageAPI->store: ', $e->getMessage(), PHP_EOL;
}
Name | Type | Description | Notes |
---|---|---|---|
body | \SplFileObject**\SplFileObject** |
\NFTStorage\Model\UploadResponse
- Content-Type:
image/png
,application/octet-stream
,multipart/form-data
- Accept:
application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]