This page gives a full guide on how to use the API + Python to upload your art/media
API Bulk Upload
Note - this guide is currently under construction
Before we get into the step by step guide, lets cover a general overview of the approach, from here, we are making the assumption that you have the image/video/3D files already created and the metadata is stored in a format that you already know how to interact with. This then reduces our challenge to:
Create a method than can upload one NFT to NFT-MAKER
Construct the API Call
Convert the source media into Base64 (unless you have already uploaded to IPFS
Build the JSON object
Make the API Call, with the JSON appended
Iterate through all media and metadata to upload the whole collection
Note - when you upload to NFT-MAKER, we also then automatically store your art on Immutable IPFS storage.
You may (this is rare) have already uploaded your art to your own IPFS storage, which makes this a slightly more simple process.
Writing the Script (Python)
To use the API, you will simply need any programming or scripting language that allows you to make HTTP POST requests and work with the JSON format. For this guide, we will demonstrate how this can be done using a very popular language - Python.
Next, create a helper function that will upload a single NFT, if provided with correct JSON data. This method below takes in the already built JSON data (see further into this guide) and the ID of the project. You will need to replace the 'xxxxxxxxxxxxx' with your API Key. This method works by creating the base API call, which is comprised of the base URL, your API Key and your project ID.
The 'uploadPost' variable then makes a HTTP POST call and pushes the JSON data, to the base API URL.
Note - the next part requires you to match your metadata to your own project, this is a working example only.
The NFT-MAKER Metadata template for this example looks like:
An example JSON Builder, to match the above Metadata template would look like:
Note that, as mentioned above, this assumes you have the raw metadata in an accessible format, hence this method takes in an array of data, where the first item (item 0) is the file name and item 1 is the serial number.
Some variables are more static (such as the website and twitter links, so these can be hard-coded). These are then added into variables, that get added to the JSON template at runtime. You can see how adding in new elements can be done for the additional data you want to implement.
"description": "BooCrew " + "Series A #" + str(NO),
Already Uploaded to IPFS
Note - on line 6, you will see the variable 'TARGET', in this case we are converting a locally stored PNG image into Base64 for uploading.
If you have already uploaded your media to another file storage like IPFS, you can simply reference the URL here and don't need to do any converting.
Line 6 will become (where element 2 of the array is the location ID of the media):
TARGET = arrayIN
Line 13 will become:
PNG to Base64
Assuming (like most projects) you have decided to let us handle the IPFS storage for you, you will need to include the raw, Base64 data for your art in the JSON that you upload. Below is some python code you can copy, which will convert a PNG file into Base64.
The final task is now to iterate through all of your raw metdata and media, running the 'uploadSingleNFT' method.