diff --git a/helpcenter.r7-office.ru/Web/Controls/Common/BaseHeader/BaseHeader.ascx b/helpcenter.r7-office.ru/Web/Controls/Common/BaseHeader/BaseHeader.ascx index b2f3e7638..d273faba6 100644 --- a/helpcenter.r7-office.ru/Web/Controls/Common/BaseHeader/BaseHeader.ascx +++ b/helpcenter.r7-office.ru/Web/Controls/Common/BaseHeader/BaseHeader.ascx @@ -17,6 +17,7 @@
One needs to perform several easy steps to pass authentication:
++POST /api/2.0/authentication.json HTTP/1.1 +Host: yourportal.onlyoffice.com +Content-Type: application/json +Accept: application/json + +{ + "userName": "yourusername", + "password": "yourpassword" +} ++
+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 +} ++
+GET api/2.0/people/@self.json HTTP/1.1 +Host: yourportal.onlyoffice.com +Accept: application/json +Authorization:sdjhfskjdhkqy739459234 ++ +
+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(); ++
+curl --request POST --header "Content-Type: application/json" --data "{\"username\":\"yourusername\",\"password\":\"yourpassword\"}" "https://yourportal.onlyoffice.com/api/2.0/authentication.json" ++
+ 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. +
++ 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 ">Authentication section. +
++ To identify the request and response format please make sure that both the Content-Type and Accept headers are set to application/json. + Any API method can be called stating the format for the response (json or xml). +
+
+ Example:
+ 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.
+
+ 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). +
++ If a request succeeds, it will return a status code in the 200 range 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. +
++ If a request fails, a non-200 status code will be returned, 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: +
+HTTP/1.1 404 Not Found+
+ 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. +
+
+ The following notation is used in the documentation:
+ {text}: states for the text that should be replaced by your own data (ID, search query, etc.)
+
+ You can ask our developers at dev.onlyoffice.org (registration required). +
+ ++ 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. +
++ 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. +
++ 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 Batch requests containing multiple methods 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. +
+ ++ The batch API takes in an array of logical HTTP requests represented as JSON arrays + - each request has a method (corresponding to HTTP method GET/PUT/POST/DELETE etc), + a relativeUrl (the portion of the URL after yourportal.onlyoffice.com), optional headers + array (corresponding to HTTP headers) and an optional body (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). +
++ To make batched requests, you build a JSON object which describes each individual + operation you'd like to perform and POST this to the ONLYOFFICE API endpoint + at /api/2.0/batch. The following example gets the current + user's profile information and the user group in a single request: +
+ ++batch = [ + { + "method": "GET", + "relativeUrl": "/api/2.0/people/@self" + }, + { + "method": "GET", + "relativeUrl": "/api/2.0/group/@self" + } +] ++ +
+ 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: +
++ For the above request, the expected response would be of the form: +
+ ++{ + "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\"}}" + } + ] +} ++ +
+ It is possible to combine operations that would normally use different HTTP methods + into a single batch request. While GET and DELETE operations + must only have a relativeUrl and a method field, POST + and PUT operations may contain an optional body 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: +
+ ++batch = [ + { + "method": "GET", + "relativeUrl": "/api/2.0/people/@self" + }, + { + "method": "POST", + "relativeUrl": "/api/2.0/people/{userid}/contacts", + "body": "contacts[0].Type=skype&contacts[0].Value=skypename&contacts[1].Type=msn&contacts[1].Value=msn_login" + } +] ++
+ The response to the requests use the Roundtrip format: 2008-04-10T06:30:00.0000000-07:00.
+
Where -07:00 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.
+
As for the request, only date can be send in it: 2008-04-10
+
+
+ If you use the date/time in URL request, colons must be avoided and replaced by hyphens: 2008-04-10T06-30-00.000Z.
+
Please note that the UTC date and time without the offset are used in this case.
+
+ You can get json or xml format adding .json or .xml to the request or pointing the request content-type in application/json or text/xml.
+
E.g.:
+ ">api/2.0/people.json
+
+ Yes. see the ">Request Filtering section. +
+
+ Every request to the API supports a certain number of parameters sent in the URL
+
+ I.e. the request ">api/2.0/people can be appended with several parameters,
+ for example ">api/2.0/people?startIndex=10&count=25
+
Parameter | +Description | +
count | +Number of the elements returned. | +
startIndex | +The number of elements to be skipped in the beginning. Used for response data pagination. | +
sortBy | +Sort by field name. | +
sortOrder | +
+ Sorting direction. Can be "descending" or "ascending". For example, used together with sortBy: + ">api/2.0/people?sortBy=userName&sortOrder=descending + |
+
filterBy | +Filter results by field name. | +
filterOp | +Filtering operation. Can be one of the following: "contains","equals","startsWith","present" | +
filterValue | +
+ Filter value. For example, used together with filterBy and filterOp: + ">api/2.0/people?filterBy=userName&filterOp=startsWith&filterValue=Alex + |
+
updatedSince | +Returns the values updated or created since a certain period of time. | +
Community Server
+