Hi,
I am able to list emails for a person like this:
→ curl -H "Authorization: Basic $AUTH" "http://192.168.22.198/sdata/crmj/sagecrm2/-/Person('1502')/Email" | jq { "$url": "http://msedgewin10/sdata/crmj/sagecrm2/-/Person('1502')/Email?startindex=1&count=10", "$first": "http://msedgewin10/sdata/crmj/sagecrm2/-/Person('1502')/Email?startindex=1&count=10", "$last": "http://msedgewin10/sdata/crmj/sagecrm2/-/Person('1502')/Email?startindex=1&count=10", "$totalResults": 1, "$startIndex": 1, "$itemsPerPage": 10, "$resources": [ { "$key": 2736, "$title": "", "$url": "http://msedgewin10/sdata/crmj/sagecrm2/-/Email('2736')", "Emai_EmailId": 2736, "emai_IntForeignID": null, "emai_intlastsyncdate": null, "Emai_EmailAddress": "[email protected]", "emai_IntId": null, "emai_promote": false, "Company": { "$url": { "Association": "http://msedgewin10/sdata/crmj/sagecrm2/-/Email('2736')/Company?startindex=1&count=10" } }, "Account": { "$url": { "Association": "http://msedgewin10/sdata/crmj/sagecrm2/-/Email('2736')/Account?startindex=1&count=10" } }, "Person": { "$url": { "Association": "http://msedgewin10/sdata/crmj/sagecrm2/-/Email('2736')/Person?startindex=1&count=10" } } } ] }
I'm also able to create email like this:
→ curl -H "Authorization: Basic $AUTH" "http://192.168.22.198/sdata/crmj/sagecrm2/-/Email" -X POST -H "Content-Type: application/json;vnd.sage=sdata" -d '{"Emai_EmailAddress":"[email protected]"}' {"$key":4190,"Emai_EmailAddress":"[email protected]"}
But I don't know how to create email assigned to a person. I tried this:
→ curl -H "Authorization: Basic $AUTH" "http://192.168.22.198/sdata/crmj/sagecrm2/-/Person('1502')/Email" -X POST -H "Content-Type: application/json;vnd.sage=sdata" -d '{"Emai_EmailAddress":"[email protected]"}' <!doctype html><html lang="en"><head><title>HTTP Status 405 – Method Not Allowed</title><style type="text/css">h1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} h2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} h3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} body {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} b {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} p {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;} a {color:black;} a.name {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 405 – Method Not Allowed</h1><hr class="line" /><p><b>Type</b> Status Report</p><p><b>Message</b> Request method 'POST' not supported</p><p><b>Description</b> The method received in the request-line is known by the origin server but not supported by the target resource.</p><hr class="line" /><h3>Apache Tomcat/8.5.24</h3></body></html>
As you see it doesn't work. What I'm doing wrong?
Also, is there a way to create person and emails using one API call?