WebTUT needs to interact with the server to gather updated data from the service. There are two ways to achieve this goal:
- To interact using a REST API with the PHP Server
- To interact using a pre-established Socket.IO connection
JS Client <-> PHP Server
On the PHP Server there is a URL prefix that will handle all the requests from the client:
- https://<host>/<path>/api
The requests are then placed using the "GET" or "POST" http methods suffixing with the name of the method being requested.
All the methods are based on a prefix name: "get*", "set*", "register*", "unregister*"
All the responses follow this structure:
{ "result": <<RESULT>>, "error": false, "status": 200 }
Where <<RESULT>> has the data that was requested by the call it self.
These methods can implement/inherit authentication from the WebTUT application. Methods that require authentication will be marked as "AAI Enabled" and will return a null result, error true and a status 401 (Authentication required) if no proper authentication is provided.
{ "result": null, "error": true, "status": 401 }
Methods
/getVersion
Retrieves the current version of the API.
Example:
https://webrtc-hub.fccn.pt/webtut/api/getVersion
Response:
{"result":{"version":1},"error":false,"status":200}
/getCurrentQueueInfo/{WebTUT Token}/{Format} (AAI Enabled)
Retrieves the current Queue Information about a WebTUT on the choosen format:
- Format:
- "html" - returns in HTML, directly to be used.
- "json" - returns data object to be processed and handled by the client directly
Example:
https://webrtc-hub.fccn.pt/webtut/api/getCurrentQueueInfo/d467c153a50841b625b6c284e2054f50/html
Response:
{"result":{"html":"5"},"error":false,"status":200}
Example:
https://webrtc-hub.fccn.pt/webtut/api/getCurrentQueueInfo/d467c153a50841b625b6c284e2054f50/json
Response:
{"result":{"queueSize":0,"participants":[]},"error":false,"status":200}