Uploads an asset. Supported file types include jpg, png, and gif. After uploading the asset file, it returns a public URI to access the asset.
You can use curl to upload the file as shown below:
curl --location --request POST 'https://metadata-api.klaytnapi.com/v1/metadata/asset' \
--header 'x-chain-id: 8217' \
--header 'Authorization: Basic S0FTS0U0Mjc5Q01VMVhLVDg1UTRBVkRBOlFEMENMam5XRW94TzZfQ3pYLV9oLWRrQkZnMDVxR1FnbWlYcDAwVno=' \
--form 'file=@"/Users/usernamed/Documents/files/1kbfile.jpg"'
Note
The URI in the response looks like this:
https://metadata-store.klaytnapi.com/{storage-id}/{assetID}.{extension}
.
{storage-id}
(UUID) is an identifier value automatically given to each user.{assetID}
is a unique identifier given to the uploaded asset.
Attach a file you want to upload.
Your request was successful.
The request is not valid.
{ "file": "@\"/Users/username/Documents/files/1kbfile.jpg\"" }
{- "contentType": "image/png",
- "filename": "4a85e6be-3215-93e6-d8a9-3a7d633584e7.png",
}