curl --request PUT \
--url https://api.example.com/interests/{id} \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>"
}
'{
"message": "<string>"
}Update an existing interest
curl --request PUT \
--url https://api.example.com/interests/{id} \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>"
}
'{
"message": "<string>"
}PUT /interests/{id}
Content-Type: application/json
{
"name": "Wildlife Photography"
}
{
"message": "Interest ID 5 data updated succesfully"
}
{
"error": "Interest not found"
}
{
"error": "name is required"
}
{
"error": "Invalid interest ID"
}
const interestId = 5;
const response = await fetch(`http://your-api-base-url.com/interests/${interestId}`, {
method: 'PUT',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Wildlife Photography'
})
});
const result = await response.json();
console.log(result.message);
id parameter must be a valid integername field is required in the request bodyname field can be updated through this endpoint