Home > OS >  How to POST Json metadata through API using placeholders
How to POST Json metadata through API using placeholders

Time:09-29

how are you doing? Thank you for your help in advance!

There is a platform for NFT minting (result

The placeholder that should receive the data I've POST returns as a blank string "".

This is what my POST look like:

curl -X 'POST' \
 'https://api.nft-maker.io/UploadNft/****/****' \
  -H 'accept: text/plain' \
  -H 'Content-Type: application/json' \
  -d '{
    "assetName": "Testing01",
    "previewImageNft": {
        "mimetype": "image/png",
        "fileFromIPFS": "QmUp9ZnFbHegzdwtg8ToXJK7kjrJrkZcKuCuXGAREeXNDr",
        "metadataPlaceholder": [
            {
                "place_holder1": "The info I need goes here",
                "place_holder2": "The info I need goes here",
                "place_holder3": "The info I need goes here",
                "place_holder4": "The info I need goes here"
            }
        ]
    }
}'

This is the Response Body I get after the POST:

{
  "nftId": 614865,
  "ipfsHashMainnft": "QmUp9ZnFbHegzdwtg8ToXJK7kjrJrkZcKuCuXGAREeXNDr",
  "ipfsHashSubfiles": [],
  "metadata": "{\r\n  \"721\": {\r\n    \"<policy_id>"\": {\r\n      \"Testing01\": {\r\n        \"one\": \"\",\r\n        \"two\": \"\",\r\n        \"three\": \"\",\r\n        \"four\": \"\",\r\n        \"five\": \"\",\r\n        \"six\": \"\",\r\n        \"seven\": \"\",\r\n        \"eight\": \"\",\r\n        \"nine\": \"\",\r\n        \"files\": [\r\n          {\r\n            \"name\": \"Testing01\",\r\n            \"mediaType\": \"image/png\",\r\n            \"src\": \"ipfs://QmUp9ZnFbHegzdwtg8ToXJK7kjrJrkZcKuCuXGAREeXNDr\"\r\n          }\r\n        ]\r\n      }\r\n    }\r\n  }\r\n}"
}

I have the option of manually overriding the entire image metadata using their dashboard:

Manual metadata override

or, I can also manually replace my placeholders:

Manual metadata placeholders

After replacing the data manually, I can see the correct metadata on the dashboard:

Correct metadata after manually replacing it

And if I use their GetNftDetails API endpoint for that image, I get this:

{
  "id": 614865,
  "ipfshash": "QmUp9ZnFbHegzdwtg8ToXJK7kjrJrkZcKuCuXGAREeXNDr",
  "state": "free",
  "name": "Testing01",
  "minted": false,
  "receiveraddress": null,
  "selldate": null,
  "soldby": null,
  "reserveduntil": null,
  "policyid": null,
  "assetid": null,
  "assetname": null,
  "fingerprint": null,
  "initialminttxhash": null,
  "title": null,
  "series": null,
  "ipfsGatewayAddress": "https://gw2.easy-ipfs.com/ipfs/QmUp9ZnFbHegzdwtg8ToXJK7kjrJrkZcKuCuXGAREeXNDr",
  "metadata": "{\r\n  \"721\": {\r\n    \"<policy_id>\": {\r\n      \"Testing01\": {\r\n        \"one\": \"Manually Editing the FIRST\",\r\n        \"two\": \"Manually Editing the SECOND\",\r\n        \"three\": \"Manually Editing the THIRD\",\r\n        \"files\": [\r\n          {\r\n            \"name\": \"Testing01\",\r\n            \"mediaType\": \"image/png\",\r\n            \"src\": \"ipfs://QmUp9ZnFbHegzdwtg8ToXJK7kjrJrkZcKuCuXGAREeXNDr\"\r\n          }\r\n        ]\r\n      }\r\n    }\r\n  }\r\n}"
}

I've also tried to POST using the "metadata": "" instead of the "metadataPlaceholder":[{}], like so:

{
    "assetName": "Testing01",
    "previewImageNft": {
        "mimetype": "image/png",
        "fileFromIPFS": "QmUp9ZnFbHegzdwtg8ToXJK7kjrJrkZcKuCuXGAREeXNDr"
    },
    "metadata": "{\r\n  \"721\": {\r\n    \"<policy_id>\": {\r\n      \"Testing01\": {\r\n        \"one\": \"FIRST\",\r\n        \"two\": \"SECOND\",\r\n        \"three\": \"THIRD\",\r\n        \"files\": [\r\n          {\r\n            \"name\": \"Testing01\",\r\n            \"mediaType\": \"image/png\",\r\n            \"src\": \"ipfs://QmUp9ZnFbHegzdwtg8ToXJK7kjrJrkZcKuCuXGAREeXNDr\"\r\n          }\r\n        ]\r\n      }\r\n    }\r\n  }\r\n}"
}

It POSTs just fine, I can see the image there, BUT I have the same problem, blank "" metadata where I have the placeholders.

There is some NFT projects currently using this platform, and they don't seem to have a problem generating this metadata...

With all of that being said... Am I being that stupid? What am I doing wrong that I can't see?

Do you guys have any idea how I should structure this metadata in the API UploadNft endpoint so I can POST it with no problem?

*I've send a e-mail for them, but couldn't get a answer yet.

CodePudding user response:

You have to post the placeholder as an array with the fields "name" and "value".

So it should looks like this:

"metadataPlaceholder": [
  {
    "name": "color",
    "value": "red"
  },
  {
    "name": "size",
    "value": "big"
  },
  {
    "name": "placerholder3",
    "value": "value3"
  }
]
  • Related