I need help with my JSON
construct. I am attempting to attach the below base64 string and to bind an existing Opportunity in D365 - using postman
WebApi Request :
POST : https://Mydomainurl.crm8.dynamics.com/api/data/v9.1/annotations
{
"subject": "Test From Web API",
"filename": "encoded oppjs.txt",
"[email protected] ":"/opportunity(0cff802f-23e1-40b3-aebc-b36b6d8d2e68)",
"documentbody" : "DQp2YXIgdzMgPSB7fTsNCnczLmhpZGUgPSBmdW5jdGlvbiAoc2VsKSB7DQogIHczLmhpZGVFbGVtZW50cyh3My5nZXRFbGVtZW50cyhzZWwpKTsNCn07DQp3My5oaWRlRWxlbWVudHMgPSBmdW5jdGlvbiAoZWxlbWVudHMpIHsNCiAgdmFyIGksIGwgPSBlbGVtZW50cy5sZW5ndGg7DQogIGZvciAoaSA9IDA7IGkgPCBsOyBpKyspIHsNCiAgICB3My5oaWRlRWxlbWVudChlbGVtZW50c1tpXSk7DQogIH0NCn07DQp3My5oaWRlRWxlbWVudCA9IGZ1bmN0aW9uIChlbGVtZW50KSB7DQogIHczLnN0eWxlRWxlbWVudChlbGVtZW50LCAiZGlzcGxheSIsICJub25lIik7DQp9Ow0KdzMuc2hvdyA9IGZ1bmN0aW9uIChzZWwsIGEpIHsNCiAgdmFyIGVsZW1lbnRzID0gdzMuZ2V0RWxlbWVudHMoc2VsKTsNCiAgaWYgKGEpIHt3My5oaWRlRWxlbWVudHMoZWxlbWVudHMpO30NCiAgdzMuc2hvd0VsZW1lbnRzKGVsZW1lbnRzKTsNCn07DQp3My5zaG93RWxlbWVudHMgPSBmdW5jdGlvbiAoZWxlbWVudHMpIHsNCiAgdmFyIGksIGwgPSBlbGVtZW50cy5sZW5ndGg7DQogIGZvciAoaSA9IDA7IGkgPCBsOyBpKyspIHsNCiAgICB3My5zaG93RWxlbWVudChlbGVtZW50c1tpXSk7DQogIH0NCn07DQp3My5zaG93RWxlbWVudCA9IGZ1bmN0aW9uIChlbGVtZW50KSB7DQogIHczLnN0eWxlRWxlbWVudChlbGVtZW50LCAiZGlzcGxh"
}
Response : 501 Bad Request
Try this json on :
POST
:https://Mydomainurl.api.crm8.dynamics.com/api/data/v9.1/annotations
and let me know, you had a couple of things wrong note the odata.bind and how this binds to the opportunity in D365 you want to link too, that and you had some spacing issues in the pasted example as well: