Accessing the API using SOAP
The other method to access the API is through a SOAP (Simple Object Access Protocol) call, which is an XML-formatted request that is sent as a POST over HTTPS. This works well (and is sometimes the only option) if you are using an API function that requires sending a large amount of data, since that’s not suitable for an HTTPS GET call.
Making an HTTP POST Request¶
Listed below is a sample HTTPS POST request to the API for the SonaGetPersonInfoByUserID function, assuming your site name is yoursite.sona-systems.com.
Request headers¶
POST /services/SonaAPI.svc/ws HTTP/1.1
Content-Type: application/soap+xml; charset=utf-8
Host: yoursite.sona-systems.com
User-Agent: myCustomClient/202309011456
Expect: 100-continue
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
Request body¶
Update the site, API key, and user ID in this request body. MessageID is optional. Your HTTP client should calculate the Content-Length header.
<s:Envelope
xmlns:s="http://www.w3.org/2003/05/soap-envelope"
xmlns:a="http://www.w3.org/2005/08/addressing">
<s:Header>
<a:Action s:mustUnderstand="1">
https://www.sona-systems.com/SonaAPI/SonaGetPersonInfoByUserID_Post
</a:Action>
<a:MessageID>urn:uuid:73e142a1-df57-4bfe-9caa-dc9ef790d50c</a:MessageID>
<a:ReplyTo>
<a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
</a:ReplyTo>
<a:To s:mustUnderstand="1">
https://yoursite.sona-systems.com/services/SonaAPI.svc/ws
</a:To>
</s:Header>
<s:Body>
<SonaGetPersonInfoByUserID_Post xmlns="https://www.sona-systems.com/">
<api_key>your_api_key_here</api_key>
<user_id>a_user</user_id>
</SonaGetPersonInfoByUserID_Post>
</s:Body>
</s:Envelope>
The main things to note here are to send the POST request to the URL but with /ws appended to the end, and to append _Post to the function call.