curl --request POST \
--url https://api.example.com/interests \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>"
}
'{
"success": [
{}
]
}Add a new interest to the system
curl --request POST \
--url https://api.example.com/interests \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>"
}
'{
"success": [
{}
]
}POST /interests
Content-Type: application/json
{
"name": "Scuba Diving"
}
[]
{
"error": "Duplicate interest name"
}
{
"error": "name is required"
}
const response = await fetch('http://your-api-base-url.com/interests', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Scuba Diving'
})
});
const result = await response.json();
console.log(result);
name field is required in the request body