Create Digital Passport Batch using CSV

Introducing the Bulk Upload API, a powerful feature designed to streamline the creation of multiple digital product passports. By simply uploading a CSV file containing the necessary data, you can efficiently mint numerous digital passports in one go.

The bulk upload process is straightforward and consists of three steps:

  1. Prepare a CSV file in the required format.
  2. Upload the CSV file to trigger the creation of digital product passports.
  3. Regularly check the status of the lines in your uploaded file by fetching the file.

This feature significantly enhances efficiency and simplifies the creation of digital product passports.

โš ๏ธ

  • Before uploading the CSV file, it's essential to create the digital passports group to which your digital passports will be assigned.
  • Each digital passport costs 1 credit.
  • Recovery time is automatically 5 years.
  • When you upload your CSV, the NFT Management Platform will check digital passports information line by line. When an error is detected, it is added in the CSV. Fetch your CSV after uploading to see potential errors.

1. Prepare a CSV file

File name

To retrieve your CSV following the file upload, the name must comply with our standards.

The naming must not include any special characters or spaces: csvOriginalName : [a-zA-Z0-9].*.csv*

CSV format

The provided CSV file must respect the following format:

product_group_idproduct_idtagsmintpublic_contentcontent
ProductGroupId1product1[โ€œtag1โ€,โ€œtag2"]truefalse{}
ProductGroupId1product2[โ€œtag1โ€,โ€œtag2"]truefalse{
"content": {
"serialNumber": "newSerialNumber"
}
}

๐Ÿ’ก

  • Special characters are accepted for the product_group_id and product_id.
  • If you don't want your digital passport to inherit the content of the digital passport group, add {}.
  • Upper and lower case are accepted for booleans: true/TRUE and false/FALSE.

Parameter

ParameterTypeRequiredDescription
product_group_idStringโœ…Digital passport group identifier of the group previously created.
product_idStringโœ…Identifier of the digital passport.
tagsStringโŒTags associated with the digital passport.
To add several tags, separate them using a comma.
mintBooleanโœ…Whether to create the digital passport directly on the blockchain.
public_contentBooleanโŒVisibility on platforms like OpenSea.
contentObjectโŒContent is optional. It is automatically inherited from the product group created above.
However, you may want to add or update an element for this particular digital passport (e.g. SKU).
โš ๏ธย This content will overwrite the data if it is defined in the product group.

2. Upload a CSV file

URL

Required rights: admin, certCreate

To upload your CSV, use /productManagement/product/batch/upload. The Upload of the CSV file triggers the creation of digital product passports.

POST - https://{{nmpUrl}}/productManagement/product/batch/upload

Parameter

ParameterTypeRequiredDescription
filemultipart/formโœ…CSV file.

Return Payload

Status CodeSuccessError Message
200trueSuccess
{
    "message": "File uploaded successfully."
}

Errors

Status CodeSuccessCodeError Message
400falsenpm.productManagement.formatErrrorThe CSV file is not formatted correctly.
400falsenpm.productManagement.formatErrrorThe CSV file already exists.
422falsenpm.productManagement.formatErrrorOnly one CSV file must be uploaded per request.
500falsenpm.productManagement.UnknownErrorAn unknown error has occurred.
{
    "message": "File with same name file.csv already exists.",
    "code": "npm.productManagement.formatErrror"
}
{
    "code": "npm.productManagement.formatErrror",
    "message": "Missing required columns: product_id"
}
{
    "message": "You should send only one file.",
    "code": "npm.productManagement.formatErrror"
}
{
    "code": "npm.productManagement.UnknownError",
    "message": "An error occurred while parsing the form data."
}

3. Regularly check the status of the lines in your uploaded file by fetching the file.

URL

Required rights: admin, certRead

To fetch a specific CSV file uploaded on your NFT Management Platform, use /productManagement/product/batch/:csvOriginalName.

The fetch function returns status on each line in the CSV file. Please note that if there is an error on one of the lines in the CSV file, no line will be processed.

GET - https://{{nmpUrl}}/productManagement/product/batch/:csvOriginalName

Parameter

Path ParameterTypeRequiredDescription
csvOriginalNameStringโœ…Name of the file.

Return Payload

Status CodeSuccessDescription
200trueThe CSV file is returned.
FieldDescription
token_idIdentification number of the digital passport on the network.
passphraseDigital passport passphrase.
errorBoolean returning if an error occurred while minting the digital passport.
โš ๏ธ - When an error occurs, the explanation is returned and the status is not displayed.

- When there is no error, the field is empty.
statusFor each line in the CSV file, a minting status of the digital passport is returned:

- draft: the draft of the Digital passport was created. It was not minted (mint flag = false in the input file)
- waiting: The transaction is waiting in the queue to be minted.
-pending: The minting is in progress.
- minted: The digital passport has been minted on the blockchain.
โš ๏ธ - The status is returned empty if an error occurred.
group_id,product_id,content,tags,mint,public_content,error,status,tokenId,passphrase
groupTestBatch_CSV-1,productTestBatchCSV_2-20,"{""$schema"":""https://cert.arianee.org/version5/ArianeeProductCertificate-i18n.json"",""name"":""TestBatchCSV3"",""description"":""this is a description"",""sku"":""sku1""}","[""test1"",""test2""]",true,true,,minted,330502713,r2z235gzd7c7
groupTestBatch_CSV-1,productTestBatchCSV_2-21,"{""$schema"":""https://cert.arianee.org/version5/ArianeeProductCertificate-i18n.json"",""name"":""TestBatchCSV3"",""description"":""this is a description"",""sku"":""sku1""}","[""test1"",""testv2""]",true,true,,minted,885483253,su0v8uomwcnt

Errors

Status CodeSuccessDescription
404falseThe CSV file name does not exist.
{
    "message": "CSV file wrongCsvFileName not found."
}