Update File Metadata
/content/:id/metadata
This endpoint is purpose-built to update the metadata associated with a Submarined file. This endpoint will result in a complete overwrite of metadata, so it's important to pass through old values and new values if you want to keep any old values.
put
https://managed.mypinata.cloud/api/v1
/content/:id/metadata
Parameters
Path
id*
The file ID (not CID)
Header
x-api-key*
SUBMARINE KEY
Body
name
Additional metadata name property
keyvalues
Stringified object of keyvalue pairs for your metadata
Responses
200: OK
cURL
Node.js
Python
Go
curl --location --request PUT 'https://managed.mypinata.cloud/api/v1/content/95c904a0-4d61-4598-a4c8-fb5f0793c7ab' \
--header 'x-api-key: SUBMARINE KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "metadata name",
"keyvalues": {
"newKey": "new value",
"oldKey": "old value"
}
}'
var axios = require('axios');
var data = JSON.stringify({
"name": "metadata name",
"keyvalues": {
"newKey": "new value",
"oldKey": "old value"
}
});
var config = {
method: 'put',
url: 'https://managed.mypinata.cloud/api/v1/content/95c904a0-4d61-4598-a4c8-fb5f0793c7ab',
headers: {
'x-api-key': 'SUBMARINE KEY',
'Content-Type': 'application/json'
},
data: data
};
const res = await axios(config);
console.log(res.data);
import requests
import json
url = "https://managed.mypinata.cloud/api/v1/content/95c904a0-4d61-4598-a4c8-fb5f0793c7ab"
payload = json.dumps({
"name": "metadata name",
"keyvalues": {
"newKey": "new value",
"oldKey": "old value"
}
})
headers = {
'x-api-key': 'SUBMARINE KEY',
'Content-Type': 'application/json'
}
response = requests.request("PUT", url, headers=headers, data=payload)
print(response.text)
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://managed.mypinata.cloud/api/v1/content/95c904a0-4d61-4598-a4c8-fb5f0793c7ab"
method := "PUT"
payload := strings.NewReader(`{
"name": "metadata name",
"keyvalues": {
"newKey": "new value",
"oldKey": "old value"
}
}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("x-api-key", "SUBMARINE KEY")
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Last modified 3mo ago