Service Discovery
Service Discovery refers to the process of finding a suitable service for a given task.
Request
To discover the service, an App must make a request to the Service using the Accept: application+xml header as in the example below:
http
GET /
HOST <VoipNowVoipNowHostname>
Authorization: Bearer <token>
Content-Type: application
Content-Length: xxx
Accept: application+xmlResponse
The Service returns the following response, which contains the address to the XRDS document:
http
HTTP.1 204
Content-Type: application; charset=UTF-8
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 no-cache, must-revalidate
...
X-XRDS-Location: https://<VoipNowHostname>/uapi/unifiedapi.xrdsThe document located at https://<VoipNowHostname>/uapi/unifiedapi.xrds has the following structure:
xml
<XRDS xmlns="xri://$xrds">
<XRD xmlns:simple="http:/-simple.net.0" xmlns="xri://$XRD*($v*2.0)" version="2.0">
<Type>xri://$xrds*simple</Type>
<Service>
<Type>https://<VoipNowHostname>/uapi/phoneCalls</Type>
<Uri>https://<VoipNowHostname>/uapi/phoneCalls/{userId}/{extensionNumber}/{phoneCallId}/</Uri>
</Service>
<Service>
<Type>https://<VoipNowHostname>/uapi/extensions</Type>
<Uri>https://<VoipNowHostname>/uapi/extensions/{userId}/{extensionNumber}/</Uri>
</Service>
<Service>
<Type>https://<VoipNowHostname>/uapi/extensions</Type>
<Uri>https://<VoipNowHostname>/uapi/extensions/{userId}/{extensionNumber}/{agentId}/</Uri>
</Service>
<Service>
<Type>https://<VoipNowHostname>/uapi/extensions</Type>
<Uri>https://<VoipNowHostname>/uapi/extensions/{userId}/{extensionNumber}CallEvents/{eventId}/</Uri>
</Service>
<Service>
<Type>https://<VoipNowHostname>/uapi/cdr</Type>
<Uri>https://<VoipNowHostname>/uapi/cdr/</Uri>
</Service>
<Service>
<Type>https://<VoipNowHostname>/uapi/faxes</Type>
<Uri>https://<VoipNowHostname>/uapi/faxes/{extensionNumber}/</Uri>
</Service>
<Service>
<Type>https:///<VoipNowHostname>/uapi/cache/invalidate</Type>
<Uri>https://<VoipNowHostname>/uapi/cache/invalidate</Uri>
</Service>
</XRD>
</XRDS>