r7: community server pages

This commit is contained in:
Sergey Linnik 2019-02-13 15:53:47 +03:00
parent 82c7cee5e0
commit 27831d8cdc
14 changed files with 529 additions and 0 deletions

View File

@ -17,6 +17,7 @@
<li class="pushy-link"><a class="menuitem" id="navitem_features" href="<%=VirtualPathUtility.ToAbsolute("~/documentation-editors/index.aspx")%>">Возможности</a></li>
<li class="pushy-submenu"><a class="menuitem" id="navitem_plugins" href="<%=VirtualPathUtility.ToAbsolute("~/desktop/documents/plugins/index.aspx")%>">Плагины</a></li>
<li class="pushy-submenu"><a class="menuitem" id="navitem_server" href="<%=VirtualPathUtility.ToAbsolute("~/server/enterprise.aspx")%>">Сервер</a></li>
<li class="pushy-submenu"><a class="menuitem" id="navitem_server" href="<%=VirtualPathUtility.ToAbsolute("~/portals/index.aspx")%>">Community</a></li>
</ul>
</nav>
</div>

View File

@ -0,0 +1,94 @@
<%@ Control Language="C#" Inherits="BaseContentUserControls" %>
<script runat="server">
protected override void Init()
{
PageTitle = PageCaption = "Authentication";
MetaKeyWords = "";
MetaDescription = "";
}
</script>
<div class="MainHelpCenter PageGuides">
<h1>
<span class="hdr">How to pass authentication?</span>
</h1>
<p>One needs to perform several easy steps to pass authentication:</p>
<ol>
<li>Send POST request, containing two parameters: <b>userName</b> and <b>password</b>, to the <a href="< %= Url.DocUrl("authentication", null, "post", "api/2.0/authentication", "portals") % >">api/2.0/authentication</a> address
<div class="header-gray">Authentication Request</div>
<pre>
POST /api/2.0/authentication.json HTTP/1.1
Host: yourportal.onlyoffice.com
Content-Type: application/json
Accept: application/json
{
"userName": "yourusername",
"password": "yourpassword"
}
</pre>
<div class="note">Please note, that you have to enter your own portal address to the <em>Host: yourportal.onlyoffice.com</em> line instead of yourportal.onlyoffice.com address.</div>
<div class="header-gray">Response</div>
<pre>
HTTP/1.1 201 Created
Cache-Control: private
Content-Type: application/json; charset=utf-8
{
"count": 1,
"response": {
"expires": "2010-07-07T17:06:03.5845502+03:00",
"token": "sdjhfskjdhkqy739459234"
},
"status": 0,
"statusCode": 201
}
</pre>
</li>
<li>In case authentication is successful, a token which will look like <b>sdjhfskjdhkqy739459234</b> will be received</li>
<li>Use this token every time you call API methods inserting it to the HTTP Header: Authorization
<div class="header-gray">Sample API Request</div>
<pre>
GET api/2.0/people/@self.json HTTP/1.1
Host: yourportal.onlyoffice.com
Accept: application/json
Authorization:sdjhfskjdhkqy739459234
</pre>
<div class="note">Please note, that you have to enter your own portal address to the <em>Host: yourportal.onlyoffice.com</em> line instead of yourportal.onlyoffice.com address.</div>
</li>
</ol>
<div id="csharp" class="header-gray">C# authentication request example</div>
<pre>
var request = System.Net.WebRequest.Create("https://yourportal.onlyoffice.com/api/2.0/authentication.json");
request.Method = "POST";
request.ContentType = "application/json";
var body = "{\"userName\":\"yourusername\",\"password\":\"yourpassword\"}";
var data = System.Text.Encoding.UTF8.GetBytes(body);
request.ContentLength = data.Length;
using (var stream = request.GetRequestStream())
{
stream.Write(data, 0, data.Length);
}
var response = (System.Net.HttpWebResponse)request.GetResponse();
var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
</pre>
<div class="note">Please note, that you have to enter your own portal address to the <em>yourportal.onlyoffice.com</em> line instead of yourportal.onlyoffice.com address.</div>
<div id="curl" class="header-gray">cURL authentication request example</div>
<pre>
curl --request POST --header "Content-Type: application/json" --data "{\"username\":\"yourusername\",\"password\":\"yourpassword\"}" "https://yourportal.onlyoffice.com/api/2.0/authentication.json"
</pre>
<div class="note">Please note, that you have to enter your own portal address to the <em>yourportal.onlyoffice.com</em> line instead of yourportal.onlyoffice.com address.</div>
</div>

View File

@ -0,0 +1,74 @@
<%@ Control Language="C#" Inherits="BaseContentUserControls" %>
<script runat="server">
protected override void Init()
{
PageTitle = PageCaption = "Basic concepts";
MetaKeyWords = "";
MetaDescription = "";
}
</script>
<div class="MainHelpCenter PageGuides">
<h1>
<span class="hdr">Basic concepts</span>
</h1>
<h2>Introduction
</h2>
<p>
The ONLYOFFICE Community Server API is implemented as REST over HTTP using GET/POST/PUT/DELETE.
All the resources, like posts or comments, have their own URLs and are designed to be manipulated in isolation.
</p>
<h2>Authentication
</h2>
<p>
Authentication in the ONLYOFFICE Community Server API is managed via the HTTP authentication, i.e. every request must include the Authorization HTTP header.
For information and examples please visit the <a href="<%=VirtualPathUtility.ToAbsolute("~/portals/auth.aspx")%>">Authentication</a> section.
</p>
<h2>Making requests
</h2>
<p>
To identify the request and response format please make sure that both the <b>Content-Type</b> and <b>Accept</b> headers are set to <em>application/json</em>.
Any API method can be called stating the format for the response (json or xml).
</p>
<p>
<b>Example:</b><br />
api/2.0/people/@self can be called both as api/2.0/people/@self.json - then the format of the returned media is = JSON
and api/2.0/people/@self.xml - then the format of the returned media is = XML.
</p>
<p>
By default the XML format is used for the response if no format is specified in the request (e.g. api/2.0/people/@self will return XML media).
</p>
<h2>Responses
</h2>
<p>
<b>If a request succeeds, it will return a status code in the 200 range</b> and, in case no format was specified in the request, an XML-formatted response.
Note that, in general, if a request causes a new record to be created (like a new post, or comment, etc.), the response will use the "201 Created" status.
Any other successful operation (like a successful query, delete, or update) will return a 200 status code.
</p>
<p>
<b>If a request fails, a non-200 status code will be returned</b>, possibly with error information in XML format as the response content.
For instance, if a requested record could not be found, the HTTP response might look something like:
</p>
<pre>HTTP/1.1 404 Not Found</pre>
<h2>Rate limiting
</h2>
<p>
You can perform up to 500 requests per 10 second period from the same IP address for the same account.
If you exceed this limit, a 503 response for the subsequent requests will be received.
Check the Retry-After header to see how many seconds to wait before you try again.
</p>
<h2>Conventions used in this documentation
</h2>
<p>
The following notation is used in the documentation:<br />
<b>{text}</b>: states for the text that should be replaced by your own data (ID, search query, etc.)
</p>
<h2>Support
</h2>
<p>
You can ask our developers at <a href="http://dev.onlyoffice.org/viewforum.php?f=9" target="_blank">dev.onlyoffice.org</a> (registration required).
</p>
</div>

View File

@ -0,0 +1,125 @@
<%@ Control Language="C#" Inherits="BaseContentUserControls" %>
<script runat="server">
protected override void Init()
{
PageTitle = PageCaption = "Batching requests";
MetaKeyWords = "";
MetaDescription = "";
}
</script>
<div class="MainHelpCenter PageGuides">
<h1>
<span class="hdr">Batching requests</span>
</h1>
<p>
The standard version of the ONLYOFFICE API is designed to make it really
easy to get data for an individual object and to browse connections between objects.
It also includes a limited ability to retrieve data for several objects in a single request.
</p>
<p>
If your application needs the ability to access significant amounts of data in a
single go - or you need to make changes to several objects at once, it is often
more efficient to batch your queries rather than make multiple individual HTTP requests.
</p>
<p>
To enable this, the ONLYOFFICE API supports request batching which allows you to pass instructions
for several operations in a single HTTP request. You can also specify dependencies
between related operations (described in the <b>Batch requests containing multiple methods</b> section below). ONLYOFFICE will process
each of your independent operations in parallel and will process your dependent
operations sequentially. Once all operations have been completed, a consolidated
response will be passed back to you and the HTTP connection will be closed.
</p>
<h2>Making a simple batched request</h2>
<p>
The batch API takes in an array of logical HTTP requests represented as JSON arrays
- each request has a <b>method</b> (corresponding to HTTP method GET/PUT/POST/DELETE etc),
a <b>relativeUrl</b> (the portion of the URL after <b>yourportal.onlyoffice.com</b>), optional headers
array (corresponding to HTTP headers) and an optional <b>body</b> (for POST and PUT requests).
The batch API returns an array of logical HTTP responses represented as JSON arrays
- each response has a status code, an optional headers array and an optional body
(which is a JSON encoded string).
</p>
<p>
To make batched requests, you build a JSON object which describes each individual
operation you'd like to perform and <b>POST</b> this to the ONLYOFFICE API endpoint
at <b>/api/2.0/batch</b>. The following example gets the current
user's profile information and the user group in a single request:
</p>
<pre>
batch = [
{
"method": "GET",
"relativeUrl": "/api/2.0/people/@self"
},
{
"method": "GET",
"relativeUrl": "/api/2.0/group/@self"
}
]
</pre>
<p>
Once both operations have been completed, ONLYOFFICE sends a response which encapsulates
the result of all the operations. For each operation, the response includes a status
code, header information, and the body. These are equivalent to the response you
could expect from each operation if performed as raw requests against the ONLYOFFICE
API. The body field contains a string encoded JSON object:
</p>
<p>
For the above request, the expected response would be of the form:
</p>
<pre>
{
"count": 1,
"startIndex": 0,
"status": 0,
"statusCode": 200,
"response": [
{
"status": 200,
"headers": {
"x-AspNet-Version": "2.0.50727",
"access-Control-Allow-Origin": "*",
"cache-Control": "private, max-age=0",
"content-Type": "application/json; charset=UTF-8"
},
"data": "{\"count\": 1, \"startIndex\": 0, \"status\": 0, \"statusCode\": 200, \"response\": {\"id\": \"293bb997-28d8-4be0-8547-6eb50add1f3c\", \"userName\": \"Mike.Zanyatski\", \"firstName\": \"Mike\", \"lastName\": \"Zanyatski\", \"email\": \"mike@gmail.com\", \"birthday\": \"1974-05-16T05:00:00.0000000+05:00\", \"sex\": \"male\", \"status\": 1, \"terminated\": null, \"department\": \"Sample group\", \"workFrom\": \"2007-10-09T05:00:00.0000000+05:00\", \"location\": \"\", \"notes\": \"\", \"displayName\": \"Mike Zanyatski\", \"title\": \"Manager\", \"contacts\": [], \"groups\": [{\"id\": \"eeb47881-6330-4b6d-8a32-82366d4caf27\", \"name\": \"Sample group\", \"manager\": \"Jake.Zazhitski\"}], \"avatarMedium\": \"/data/0/userphotos/eeb47881-6330-4b6d-8a32-82366d4caf27_size_48-48.jpeg\", \"avatar\": \"/data/0/userphotos/eeb47881-6330-4b6d-8a32-82366d4caf27_size_82-82.jpeg\", \"avatarSmall\": \"/data/0/userphotos/eeb47881-6330-4b6d-8a32-82366d4caf27_size_32-32.jpeg\"}}"
}
]
}
</pre>
<h2>Batch requests containing multiple methods</h2>
<p>
It is possible to combine operations that would normally use different HTTP methods
into a single batch request. While <b>GET</b> and <b>DELETE</b> operations
must only have a <b>relativeUrl</b> and a <b>method</b> field, <b>POST</b>
and <b>PUT</b> operations may contain an optional <b>body</b> field.
This should be formatted as a raw HTTP POST body string, similar to a URL query
string. The following example gets information on the current contact and updates
the contact information for the contact with the selected ID in a single operation:
</p>
<pre>
batch = [
{
"method": "GET",
"relativeUrl": "/api/2.0/people/@self"
},
{
"method": "POST",
"relativeUrl": "/api/2.0/people/{userid}/contacts",
"body": "contacts[0].Type=skype&amp;contacts[0].Value=skypename&amp;contacts[1].Type=msn&amp;contacts[1].Value=msn_login"
}
]
</pre>
</div>

View File

@ -0,0 +1,42 @@
<%@ Control Language="C#" Inherits="BaseContentUserControls" %>
<script runat="server">
protected override void Init()
{
PageTitle = PageCaption = "Faq";
MetaKeyWords = "";
MetaDescription = "";
}
</script>
<div class="MainHelpCenter PageGuides">
<h1>
<span class="hdr">Frequently Asked Questions</span>
</h1>
<div class="header-gray">What is the date/time format used in the response to the requests?</div>
<p>
The response to the requests use the Roundtrip format: 2008-04-10T06:30:00.0000000-07:00.
<br />Where <em>-07:00</em> is UTC offset which is set on the portal.
In case the portal uses UTC time without any offset the date/time format in the response will be the following:
2008-04-10T06:30:00.0000000Z.
<br />As for the request, only date can be send in it: 2008-04-10
<br />
<br />
<b>If you use the date/time in URL request, colons must be avoided and replaced by hyphens: 2008-04-10T06-30-00.000Z.</b>
<br />Please note that the UTC date and time without the offset are used in this case.
</p>
<div class="header-gray">How to get json or xml format?</div>
<p>
You can get json or xml format adding <em>.json</em> or <em>.xml</em> to the request or pointing the request content-type in application/json or text/xml.
<br />E.g.:
<a href="< %= Url.DocUrl("people", null, "get", "api/2.0/people", "portals") % >">api/2.0/people.json</a>
</p>
<div class="header-gray">Is the response data pagination supported?</div>
<p>
Yes. see the <a href="<%= VirtualPathUtility.ToAbsolute("~/portals/filters.aspx") %>">Request Filtering</a> section.
</p>
</div>

View File

@ -0,0 +1,77 @@
<%@ Control Language="C#" Inherits="BaseContentUserControls" %>
<script runat="server">
protected override void Init()
{
PageTitle = PageCaption = "Filters";
MetaKeyWords = "";
MetaDescription = "";
}
</script>
<div class="MainHelpCenter PageGuides">
<h1>
<span class="hdr">Request filtering</span>
</h1>
<p>
Every request to the API supports a certain number of parameters sent in the URL
<br/>
I.e. the request <a href="< %= Url.DocUrl("people", null, "get", "api/2.0/people", "portals") % >">api/2.0/people</a> can be appended with several parameters,
for example <a href="< %= Url.DocUrl("people", null, "get", "api/2.0/people", "portals") % >">api/2.0/people?startIndex=10&amp;count=25</a>
</p>
<table class="table">
<colgroup>
<col style="width: 25%"/>
<col/>
</colgroup>
<thead>
<tr class="tablerow">
<td>Parameter</td>
<td>Description</td>
</tr>
</thead>
<tbody>
<tr class="tablerow">
<td>count</td>
<td>Number of the elements returned.</td>
</tr>
<tr class="tablerow">
<td>startIndex</td>
<td>The number of elements to be skipped in the beginning. Used for response data pagination.</td>
</tr>
<tr class="tablerow">
<td>sortBy</td>
<td>Sort by field name.</td>
</tr>
<tr class="tablerow">
<td>sortOrder</td>
<td>
Sorting direction. Can be "descending" or "ascending". For example, used together with sortBy:<br/>
<a href="< %= Url.DocUrl("people", null, "get", "api/2.0/people", "portals") % >">api/2.0/people?sortBy=userName&amp;sortOrder=descending</a>
</td>
</tr>
<tr class="tablerow">
<td>filterBy</td>
<td>Filter results by field name.</td>
</tr>
<tr class="tablerow">
<td>filterOp</td>
<td>Filtering operation. Can be one of the following: "contains","equals","startsWith","present"</td>
</tr>
<tr class="tablerow">
<td>filterValue</td>
<td>
Filter value. For example, used together with filterBy and filterOp:<br/>
<a href="< %= Url.DocUrl("people", null, "get", "api/2.0/people", "portals") % >">api/2.0/people?filterBy=userName&amp;filterOp=startsWith&amp;filterValue=Alex</a>
</td>
</tr>
<tr class="tablerow">
<td>updatedSince</td>
<td>Returns the values updated or created since a certain period of time.</td>
</tr>
</tbody>
</table>
</div>

View File

@ -0,0 +1,17 @@
<%@ Control Language="C#" %>
<ul>
<li><a class="leftmenu_plugins_toggle_menu toggler">Get Started</a>
<ul class="leftmenu_plugins_toggle_menu_expand">
<li><a href="<%= VirtualPathUtility.ToAbsolute("~/portals/index.aspx") %>">Basic concepts</a></li>
<li><a href="<%= VirtualPathUtility.ToAbsolute("~/portals/auth.aspx") %>">Passing authentication</a></li>
</ul>
</li>
<li><a class="leftmenu_plugins_toggle_menu toggler">Help</a>
<ul class="leftmenu_plugins_toggle_menu_expand">
<li><a href="<%= VirtualPathUtility.ToAbsolute("~/portals/faq.aspx") %>">F.A.Q.</a></li>
<li><a href="<%= VirtualPathUtility.ToAbsolute("~/portals/filters.aspx") %>">Filtering</a></li>
<li><a href="<%= VirtualPathUtility.ToAbsolute("~/portals/batch.aspx") %>">Batching</a></li>
</ul>
</li>
</ul>

View File

@ -0,0 +1,7 @@
<%@ Control Language="C#" %>
<%@ Register Namespace="TeamLab.Controls" Assembly="__Code" TagPrefix="cc" %>
<ul>
<li><p>Community Server</p>
<cc:LocalizeContent runat="Server" ControlName="~/Controls/Help/SideMenu/portals.ascx" />
</li>
</ul>

View File

@ -0,0 +1,17 @@
<%@ Master Language="C#" MasterPageFile="~/Masters/ArticleListPage.master" %>
<%@ Register Namespace="TeamLab.Controls" Assembly="__Code" TagPrefix="cc" %>
<asp:Content ID="Content1" ContentPlaceHolderID="pagebodyidlink" runat="Server">
<asp:contentplaceholder id="pagebodyidpage" runat="server"></asp:contentplaceholder>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="breadstoplink" runat="Server">
<asp:contentplaceholder id="breadstop" runat="server"></asp:contentplaceholder>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="leftmenupagelink" runat="Server">
<asp:contentplaceholder id="leftmenupage" runat="server"></asp:contentplaceholder>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="contentlink" runat="Server">
<cc:LocalizeContent ID="LocalizeContent8" runat="Server" ControlName="~/Controls/Help/VariousControls/HelpLinks/PortalsLinks.ascx" />
</div>
<asp:contentplaceholder id="content" runat="server"></asp:contentplaceholder>
</asp:Content>

View File

@ -0,0 +1,15 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/Masters/PortalsList.master" %>
<%@ Register Namespace="TeamLab.Controls" Assembly="__Code" TagPrefix="cc" %>
<asp:Content ID="Content4" ContentPlaceHolderID="pagebodyidpage" runat="Server">
<body class="">
</asp:Content>
<asp:Content ID="content3" ContentPlaceHolderID="breadstop" runat="server">
<h5><a href="<%= VirtualPathUtility.ToAbsolute("~/portals/index.aspx") %>">Community server</a></h5>
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="content" runat="Server">
<cc:LocalizeContent runat="Server" ControlName="~/Controls/Help/Portals/batch.ascx" />
</asp:Content>
<asp:Content ID="content2" ContentPlaceHolderID="leftmenupage" runat="server">
<div class="">
</asp:Content>

View File

@ -0,0 +1,15 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/Masters/PortalsList.master" %>
<%@ Register Namespace="TeamLab.Controls" Assembly="__Code" TagPrefix="cc" %>
<asp:Content ID="Content4" ContentPlaceHolderID="pagebodyidpage" runat="Server">
<body class="">
</asp:Content>
<asp:Content ID="content3" ContentPlaceHolderID="breadstop" runat="server">
<h5><a href="<%= VirtualPathUtility.ToAbsolute("~/portals/index.aspx") %>">Community server</a></h5>
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="content" runat="Server">
<cc:LocalizeContent runat="Server" ControlName="~/Controls/Help/Portals/faq.ascx" />
</asp:Content>
<asp:Content ID="content2" ContentPlaceHolderID="leftmenupage" runat="server">
<div class="">
</asp:Content>

View File

@ -0,0 +1,15 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/Masters/PortalsList.master" %>
<%@ Register Namespace="TeamLab.Controls" Assembly="__Code" TagPrefix="cc" %>
<asp:Content ID="Content4" ContentPlaceHolderID="pagebodyidpage" runat="Server">
<body class="">
</asp:Content>
<asp:Content ID="content3" ContentPlaceHolderID="breadstop" runat="server">
<h5><a href="<%= VirtualPathUtility.ToAbsolute("~/portals/index.aspx") %>">Community server</a></h5>
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="content" runat="Server">
<cc:LocalizeContent runat="Server" ControlName="~/Controls/Help/Portals/filters.ascx" />
</asp:Content>
<asp:Content ID="content2" ContentPlaceHolderID="leftmenupage" runat="server">
<div class="">
</asp:Content>

View File

@ -0,0 +1,15 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/Masters/PortalsList.master" %>
<%@ Register Namespace="TeamLab.Controls" Assembly="__Code" TagPrefix="cc" %>
<asp:Content ID="Content4" ContentPlaceHolderID="pagebodyidpage" runat="Server">
<body class="">
</asp:Content>
<asp:Content ID="content3" ContentPlaceHolderID="breadstop" runat="server">
<h5><a href="<%= VirtualPathUtility.ToAbsolute("~/portals/index.aspx") %>">Community server</a></h5>
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="content" runat="Server">
<cc:LocalizeContent runat="Server" ControlName="~/Controls/Help/Portals/auth.ascx" />
</asp:Content>
<asp:Content ID="content2" ContentPlaceHolderID="leftmenupage" runat="server">
<div class="">
</asp:Content>

View File

@ -0,0 +1,15 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/Masters/PortalsList.master" %>
<%@ Register Namespace="TeamLab.Controls" Assembly="__Code" TagPrefix="cc" %>
<asp:Content ID="Content4" ContentPlaceHolderID="pagebodyidpage" runat="Server">
<body class="">
</asp:Content>
<asp:Content ID="content3" ContentPlaceHolderID="breadstop" runat="server">
<h5><a href="<%= VirtualPathUtility.ToAbsolute("~/portals/index.aspx") %>">Community server</a></h5>
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="content" runat="Server">
<cc:LocalizeContent runat="Server" ControlName="~/Controls/Help/Portals/Basic.ascx" />
</asp:Content>
<asp:Content ID="content2" ContentPlaceHolderID="leftmenupage" runat="server">
<div class="">
</asp:Content>