{"id":290,"date":"2018-07-16T23:27:00","date_gmt":"2018-07-16T23:27:00","guid":{"rendered":"https:\/\/html5-chat.com\/blog\/?p=290"},"modified":"2021-11-09T14:47:04","modified_gmt":"2021-11-09T14:47:04","slug":"rest-api-for-html5-chat","status":"publish","type":"post","link":"https:\/\/html5-chat.com\/blog\/rest-api-for-html5-chat\/","title":{"rendered":"REST API for HTML5 chat (updated)"},"content":{"rendered":"<h2>New HTML5 features REST API available (updated Nov 2020)<\/h2>\n<p><strong>These features are only for SUBSCRIBED ussers.<\/strong><\/p>\n<p><span style=\"color: #800000;\"><strong>-&gt; Log in into your <a style=\"color: #800000;\" href=\"\/chatadmin\">chatadmin<\/a> \/ developers panel to get your REST API URL.<\/strong><\/span><\/p>\n<p>We are adding new REST interfaces that allow users to get some informations about their chat.<\/p>\n<p>The pattern is:<\/p>\n<blockquote><p>https:\/\/YOUR_REST_API_LINK:2083\/{action}\/{webmasterid}\/{token}<\/p><\/blockquote>\n<p>For now we added these REST APIs:<\/p>\n<hr \/>\n<p><strong>getNumberUsers:\u00a0<\/strong>allows to get the number of users in all rooms in chat!<\/p>\n<p><em>This example is for : webmasterid = 1\u00a0token = 999<\/em><\/p>\n<blockquote><p>https:\/\/YOUR_REST_API_LINK:2083\/getNumberUsers\/1\/999<\/p><\/blockquote>\n<hr \/>\n<p><strong>getUsers :\u00a0<\/strong>get all users in all rooms in chat<\/p>\n<p><em>This example is for : webmasterid = 1\u00a0token = 999<\/em><\/p>\n<p>https:\/\/YOUR_REST_API_LINK:2083\/getUsers\/1\/999<\/p>\n<hr \/>\n<p><strong>getPerformers <\/strong>: get all performers in a namespace webmasterid (performers = users whose role = &#8216;performer&#8217;)<\/p>\n<p><em>This example is for : webmasterid = 1\u00a0token = 999<\/em><\/p>\n<blockquote><p>https:\/\/YOUR_REST_API_LINK:2083\/getPerformers\/1\/999<\/p><\/blockquote>\n<hr \/>\n<hr \/>\n<p><strong>getOnlinePerformers <\/strong>: get all online performers in a namespace webmasterid (performers = users whose role = &#8216;performer&#8217;)<\/p>\n<p><em>This example is for : webmasterid = 1\u00a0token = 999<\/em><\/p>\n<blockquote><p>https:\/\/YOUR_REST_API_LINK:2083\/getOnlinePerformers \/1\/999<\/p><\/blockquote>\n<hr \/>\n<p><strong>getUserStatus<\/strong>: get the status of userid in a namespace webmasterid\u00a0 (returns: &#8220;online&#8221; or &#8220;offline&#8221;\u00a0 or &#8220;busy&#8221;)<\/p>\n<p><em>This example is for : webmasterid = 1 userid= 300<\/em><\/p>\n<blockquote><p>https:\/\/YOUR_REST_API_LINK:2083\/getUserStatus\/1\/300<\/p><\/blockquote>\n<hr \/>\n<p><strong>getUsersInRoom<\/strong>: get all users in a room roomid of namespace webmasterid<\/p>\n<p><em>This example is for : webmasterid = 1 roomid = 50<\/em><\/p>\n<blockquote><p>https:\/\/YOUR_REST_API_LINK:2083\/getUsersInRoom\/1\/50\/token<\/p><\/blockquote>\n<hr \/>\n<p><strong>getNumberUsersInRoom<\/strong>: return the number of users of a room roomid in namespace webmasterid<\/p>\n<p><em>This example is for : webmasterid = 1 roomid = 50, token=999<\/em><\/p>\n<blockquote><p>https:\/\/YOUR_REST_API_LINK:2083\/getNumberUsersInRoom\/1\/50\/999<\/p><\/blockquote>\n<hr \/>\n<p>How to use that in php for instance: (we suppose your YOUR_REST_API_LINK is https:\/\/chat.html5-chat.com which can be DIFFERENT on your website: connect to <a href=\"\/chatadmin\">chatadmin<\/a> -&gt; <strong>developers<\/strong>\u00a0 to get yours)<\/p>\n<pre class=\"prettyprint\">$numberOfUsers = file_get_contents(\"https:\/\/chat.html5-chat.com:2083\/getNumberUsers\/1\/50\/999\");\n\n<\/pre>\n<p><strong>getRooms<\/strong>: return your chat rooms.<\/p>\n<p><em>This example is for : webmasterid = 1, token=999<\/em><\/p>\n<blockquote><p>https:\/\/YOUR_REST_API_LINK:2083\/getRooms\/1\/999<\/p><\/blockquote>\n<hr \/>\n<p>How to use that in php for instance: (we suppose your YOUR_REST_API_LINK is https:\/\/chat.html5-chat.com which can be DIFFERENT on your website: connect to <a href=\"\/chatadmin\">chatadmin<\/a> -&gt; <strong>developers<\/strong>\u00a0 to get yours)<\/p>\n<pre class=\"prettyprint\">$rooms = json_decode(file_get_contents(\"https:\/\/chat.html5-chat.com:2083\/getRooms\/1\/999\"));<\/pre>\n<pre class=\"prettyprint\">print_r($rooms)<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>New HTML5 features REST API available (updated Nov 2020) These features are only for SUBSCRIBED ussers. -&gt; Log in into your chatadmin \/ developers panel to get your REST API URL. We are adding new REST interfaces that allow users to get some informations about their chat. The pattern is: https:\/\/YOUR_REST_API_LINK:2083\/{action}\/{webmasterid}\/{token} For now we added [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":293,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-290","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-features"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/html5-chat.com\/blog\/wp-json\/wp\/v2\/posts\/290","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/html5-chat.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/html5-chat.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/html5-chat.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/html5-chat.com\/blog\/wp-json\/wp\/v2\/comments?post=290"}],"version-history":[{"count":16,"href":"https:\/\/html5-chat.com\/blog\/wp-json\/wp\/v2\/posts\/290\/revisions"}],"predecessor-version":[{"id":1306,"href":"https:\/\/html5-chat.com\/blog\/wp-json\/wp\/v2\/posts\/290\/revisions\/1306"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/html5-chat.com\/blog\/wp-json\/wp\/v2\/media\/293"}],"wp:attachment":[{"href":"https:\/\/html5-chat.com\/blog\/wp-json\/wp\/v2\/media?parent=290"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/html5-chat.com\/blog\/wp-json\/wp\/v2\/categories?post=290"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/html5-chat.com\/blog\/wp-json\/wp\/v2\/tags?post=290"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}