Excerpt |
---|
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/xrds+xml header as in the example below:
Code Block |
---|
|
GET /uapi/
HOST <HostName>
Authorization: Bearer <token>
Content-Type: application/json
Content-Length: xxx
Accept: application/xrds+xml
|
Response
The Service returns the following response, which contains the address to the XRDS document:
Code Block |
---|
|
HTTP/1.1 204
Content-Type: application/json; charset=UTF-8
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 no-cache, must-revalidate
...
X-XRDS-Location: <hostname>/uapi/unfiedapi.xrds |
The document located at <hostname>/uapi/unfiedapi.xrds has the following structure:
Code Block |
---|
language | html/xml |
---|
title | Discovery Document |
---|
|
<XRDS xmlns="xri://$xrds">
<XRD xmlns:simple="http://xrds-simple.net/core/1.0" xmlns="xri://$XRD*($v*2.0)" version="2.0">
<Type>xri://$xrds*simple</Type>
<Service>
<Type>https://<hostname>/uapi/phoneCalls</Type>
<Uri>https://<hostname>/uapi/phoneCalls/{userId}/{extensionNumber}/{phoneCallId}/</Uri>
</Service>
<Service>
<Type>https://<hostname>/uapi/extensions</Type>
<Uri>https://<hostname>/uapi/extensions/{userId}/{extensionNumber}/presence/</Uri>
</Service>
<Service>
<Type>https://<hostname>/uapi/extensions</Type>
<Uri>https://<hostname>/uapi/extensions/{userId}/{extensionNumber}/queue/agents/{agentId}/</Uri>
</Service>
<Service>
<Type>https://<hostname>/uapi/extensions</Type>
<Uri>https://<hostname>/uapi/extensions/{userId}/{extensionNumber}/phoneCallEvents/{eventId}/</Uri>
</Service>
<Service>
<Type>https://<hostname>/uapi/cdr</Type>
<Uri>https://<hostname>/uapi/cdr/</Uri>
</Service>
<Service>
<Type>https://<hostname>/uapi/faxes</Type>
<Uri>https://<hostname>/uapi/faxes/{extensionNumber}/</Uri>
</Service>
<Service>
<Type>https:///<hostname>/uapi/cache/invalidate</Type>
<Uri>https://<hostname>/uapi/cache/invalidate</Uri>
</Service>
</XRD>
</XRDS> |