Cannot create a note-Engagement

I am trying to create a note for a deal but I get this error message-

FetchError: invalid json response body at https://api.hubapi.com/engagements/v1/engagements?hapikey=demo reason: Unexpected end of JSON input

This is the code that I had written-

var form = {
 "engagement": {
 "active": true,
 "ownerId": 1,
 "type": "NOTE",
 "timestamp": 1409172644778
 },
 "associations": {
 "contactIds": [2],
 "companyIds": [ ],
 "dealIds": [ ],
 "ownerIds": [ ]
 },
 "attachments": [
 {
 "id": 4241968539
 }
 ],
 "metadata": {
 "body": "note body"
 }
}

 url_deal='https://api.hubapi.com/engagements/v1/engagements?hapikey=demo';
 fetch(url_deal, {
 method: 'put',
 headers: {
 'Accept': 'application/json, text/plain, */*',
 'Content-Type': 'application/json'
 },
 body: JSON.stringify(form)
 }).then(res=>res.json())
 .then(res => context.log(res));

Any help on this matter would be greatly appreciated!

Hey, @ricky23.

It looks like you found the issue in this post: You were using the PUT method when this endpoint only accepts POST.