mirror of
https://github.com/MarshalX/telegram-crawler.git
synced 2024-11-29 03:33:09 +01:00
Update content of files
This commit is contained in:
parent
d0fadcf4f0
commit
ece8ce1ceb
2 changed files with 25 additions and 24 deletions
|
@ -41,28 +41,27 @@
|
|||
|
||||
<div id="dev_page_content"><p>There will be errors when working with the API, and they must be correctly handled on the client.</p>
|
||||
<p>An error is characterized by several parameters:</p>
|
||||
<h4><a class="anchor" href="#error-code" id="error-code" name="error-code"><i class="anchor-icon"></i></a>Error Code</h4>
|
||||
<h4><a class="anchor" name="error-code" href="#error-code"><i class="anchor-icon"></i></a>Error Code</h4>
|
||||
<p>Numerical value similar to HTTP status. Contains information on the type of error that occurred: for example, a data input error, privacy error, or server error. This is a required parameter.</p>
|
||||
<h4><a class="anchor" href="#error-type" id="error-type" name="error-type"><i class="anchor-icon"></i></a>Error Type</h4>
|
||||
<h4><a class="anchor" name="error-type" href="#error-type"><i class="anchor-icon"></i></a>Error Type</h4>
|
||||
<p>A string literal in the form of <code>/[A-Z_0-9]+/</code>, which summarizes the problem. For example, <code>AUTH_KEY_UNREGISTERED</code>. This is an optional parameter.</p>
|
||||
<hr>
|
||||
<h4><a class="anchor" href="#error-constructors" id="error-constructors" name="error-constructors"><i class="anchor-icon"></i></a>Error Constructors</h4>
|
||||
<h4><a class="anchor" name="error-constructors" href="#error-constructors"><i class="anchor-icon"></i></a>Error Constructors</h4>
|
||||
<p>There should be a way to handle errors that are returned in <a href="/mtproto/service_messages#rpc-error">rpc_error</a> constructors.</p>
|
||||
<p>Below is a list of error codes and their meanings:</p>
|
||||
<h3><a class="anchor" href="#303-see-other" id="303-see-other" name="303-see-other"><i class="anchor-icon"></i></a>303 SEE_OTHER</h3>
|
||||
<h3><a class="anchor" name="303-see-other" href="#303-see-other"><i class="anchor-icon"></i></a>303 SEE_OTHER</h3>
|
||||
<p>The request must be repeated, but directed to a different data center.</p>
|
||||
<h4><a class="anchor" href="#examples-of-errors" id="examples-of-errors" name="examples-of-errors"><i class="anchor-icon"></i></a>Examples of Errors:</h4>
|
||||
<h4><a class="anchor" name="examples-of-errors" href="#examples-of-errors"><i class="anchor-icon"></i></a>Examples of Errors:</h4>
|
||||
<ul>
|
||||
<li>FILE_MIGRATE_X: the file to be accessed is currently stored in a different data center.</li>
|
||||
<li>PHONE_MIGRATE_X: the phone number a user is trying to use for authorization is associated with a different data center.</li>
|
||||
<li>NETWORK_MIGRATE_X: the source IP address is associated with a different data center (for registration)</li>
|
||||
<li>USER_MIGRATE_X: the user whose identity is being used to execute queries is associated with a different data center (for registration)</li>
|
||||
</ul>
|
||||
<p>In all these cases, the error description’s string literal contains the number of the data center (instead of the X) to which the repeated query must be sent.
|
||||
<a href="/api/datacenter">More information about redirects between data centers »</a></p>
|
||||
<h3><a class="anchor" href="#400-bad-request" id="400-bad-request" name="400-bad-request"><i class="anchor-icon"></i></a>400 BAD_REQUEST</h3>
|
||||
<p>In all these cases, the error description’s string literal contains the number of the data center (instead of the X) to which the repeated query must be sent.<br><a href="/api/datacenter">More information about redirects between data centers »</a></p>
|
||||
<h3><a class="anchor" name="400-bad-request" href="#400-bad-request"><i class="anchor-icon"></i></a>400 BAD_REQUEST</h3>
|
||||
<p>The query contains errors. In the event that a request was created using a form and contains user generated data, the user should be notified that the data must be corrected before the query is repeated.</p>
|
||||
<h4><a class="anchor" href="#examples-of-errors" id="examples-of-errors" name="examples-of-errors"><i class="anchor-icon"></i></a>Examples of Errors:</h4>
|
||||
<h4><a class="anchor" name="examples-of-errors" href="#examples-of-errors"><i class="anchor-icon"></i></a>Examples of Errors:</h4>
|
||||
<ul>
|
||||
<li>FIRSTNAME_INVALID: The first name is invalid</li>
|
||||
<li>LASTNAME_INVALID: The last name is invalid</li>
|
||||
|
@ -83,11 +82,12 @@
|
|||
<li>PHOTO_INVALID_DIMENSIONS: The photo dimensions are invalid</li>
|
||||
<li>FIELD_NAME_INVALID: The field with the name FIELD_NAME is invalid</li>
|
||||
<li>FIELD_NAME_EMPTY: The field with the name FIELD_NAME is missing</li>
|
||||
<li>MSG_WAIT_FAILED: A waiting call returned an error</li>
|
||||
<li>MSG_WAIT_FAILED: A request that must be completed before processing the current request returned an error</li>
|
||||
<li>MSG_WAIT_TIMEOUT: A request that must be completed before processing the current request didn't finish processing yet</li>
|
||||
</ul>
|
||||
<h3><a class="anchor" href="#401-unauthorized" id="401-unauthorized" name="401-unauthorized"><i class="anchor-icon"></i></a>401 UNAUTHORIZED</h3>
|
||||
<h3><a class="anchor" name="401-unauthorized" href="#401-unauthorized"><i class="anchor-icon"></i></a>401 UNAUTHORIZED</h3>
|
||||
<p>There was an unauthorized attempt to use functionality available only to authorized users.</p>
|
||||
<h4><a class="anchor" href="#examples-of-errors" id="examples-of-errors" name="examples-of-errors"><i class="anchor-icon"></i></a>Examples of Errors:</h4>
|
||||
<h4><a class="anchor" name="examples-of-errors" href="#examples-of-errors"><i class="anchor-icon"></i></a>Examples of Errors:</h4>
|
||||
<ul>
|
||||
<li>AUTH_KEY_UNREGISTERED: The key is not registered in the system</li>
|
||||
<li>AUTH_KEY_INVALID: The key is invalid</li>
|
||||
|
@ -96,23 +96,24 @@
|
|||
<li>SESSION_EXPIRED: The authorization has expired</li>
|
||||
<li>AUTH_KEY_PERM_EMPTY: The method is unavailble for temporary authorization key, not bound to permanent</li>
|
||||
</ul>
|
||||
<h3><a class="anchor" href="#403-forbidden" id="403-forbidden" name="403-forbidden"><i class="anchor-icon"></i></a>403 FORBIDDEN</h3>
|
||||
<h3><a class="anchor" name="403-forbidden" href="#403-forbidden"><i class="anchor-icon"></i></a>403 FORBIDDEN</h3>
|
||||
<p>Privacy violation. For example, an attempt to write a message to someone who has blacklisted the current user.</p>
|
||||
<h3><a class="anchor" href="#404-not-found" id="404-not-found" name="404-not-found"><i class="anchor-icon"></i></a>404 NOT_FOUND</h3>
|
||||
<h3><a class="anchor" name="404-not-found" href="#404-not-found"><i class="anchor-icon"></i></a>404 NOT_FOUND</h3>
|
||||
<p>An attempt to invoke a non-existent object, such as a method.</p>
|
||||
<h3><a class="anchor" href="#406-not-acceptable" id="406-not-acceptable" name="406-not-acceptable"><i class="anchor-icon"></i></a>406 NOT_ACCEPTABLE</h3>
|
||||
<h3><a class="anchor" name="406-not-acceptable" href="#406-not-acceptable"><i class="anchor-icon"></i></a>406 NOT_ACCEPTABLE</h3>
|
||||
<p>Similar to <a href="#400-bad-request">400 BAD_REQUEST</a>, but the app should not display any error messages to user in UI as a result of this response. The error message will be delivered via <a href="/constructor/updateServiceNotification">updateServiceNotification</a> instead.</p>
|
||||
<h3><a class="anchor" href="#420-flood" id="420-flood" name="420-flood"><i class="anchor-icon"></i></a>420 FLOOD</h3>
|
||||
<h3><a class="anchor" name="420-flood" href="#420-flood"><i class="anchor-icon"></i></a>420 FLOOD</h3>
|
||||
<p>The maximum allowed number of attempts to invoke the given method with the given input parameters has been exceeded. For example, in an attempt to request a large number of text messages (SMS) for the same phone number.</p>
|
||||
<h4><a class="anchor" href="#error-example" id="error-example" name="error-example"><i class="anchor-icon"></i></a>Error Example:</h4>
|
||||
<h4><a class="anchor" name="error-example" href="#error-example"><i class="anchor-icon"></i></a>Error Example:</h4>
|
||||
<ul>
|
||||
<li>FLOOD_WAIT_X: A wait of X seconds is required (where X is a number)</li>
|
||||
</ul>
|
||||
<h3><a class="anchor" href="#500-internal" id="500-internal" name="500-internal"><i class="anchor-icon"></i></a>500 INTERNAL</h3>
|
||||
<h3><a class="anchor" name="500-internal" href="#500-internal"><i class="anchor-icon"></i></a>500 INTERNAL</h3>
|
||||
<p>An internal server error occurred while a request was being processed; for example, there was a disruption while accessing a database or file storage.</p>
|
||||
<p>If a client receives a 500 error, or you believe this error should not have occurred, please collect as much information as possible about the query and error and send it to the developers.</p>
|
||||
<h3><a class="anchor" href="#other-error-codes" id="other-error-codes" name="other-error-codes"><i class="anchor-icon"></i></a>Other Error Codes</h3>
|
||||
<p>If a server returns an error with a code other than the ones listed above, it may be considered the same as a 500 error and treated as an <a href="#500-internal">internal server error</a>.</p></div>
|
||||
<h3><a class="anchor" name="other-error-codes" href="#other-error-codes"><i class="anchor-icon"></i></a>Other Error Codes</h3>
|
||||
<p>If a server returns an error with a code other than the ones listed above, it may be considered the same as a 500 error and treated as an <a href="#500-internal">internal server error</a>.</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
<p>The need to add a new object constructor or to add/remove a field in a constructor creates a backwards compatibility problem for previous versions of API clients. After all, simply changing a constructor in a schema also changes its number. To address this problem, each schema update is separated into a layer.<br>A layer is a collection of updated methods or constructors in a TL schema. Each layer is numbered with sequentially increasing numbers starting with 2. The first layer is the base layer — the TL schema without any changes.</p>
|
||||
<p>There is helper method to let the API know that a client supports Layer <code>layer</code>:</p>
|
||||
<pre><code>invokeWithLayer#da9b0d0d {X:Type} layer:int query:!X = X;</code></pre>
|
||||
<p>The helper method <strong><a href="/method/invokeWithLayer">invokeWithLayer</a></strong> can be used only together with <a href="/method/initConnection">initConnection</a>: the present layer will be saved with all other parameters of the client and future calls will be using this saved value. <a href="#saving-client-info">See more below.</a>.</p>
|
||||
<p>The helper method <strong><a href="/method/invokeWithLayer">invokeWithLayer</a></strong> can be used only together with <a href="/method/initConnection">initConnection</a>: the present layer will be saved with all other parameters of the client and future calls will be using this saved value. <a href="#saving-client-info">See more below</a>.</p>
|
||||
<h4><a class="anchor" name="list-of-available-layers" href="#list-of-available-layers"><i class="anchor-icon"></i></a><a href="/api/layers">List of Available Layers</a></h4>
|
||||
<h3><a class="anchor" name="saving-client-info" href="#saving-client-info"><i class="anchor-icon"></i></a>Saving Client Info</h3>
|
||||
<p>It is possible to save information about the current client on the server in conjunction with an authorization key. This may help eliminate client-side problems with certain releases on certain devices or with certain localizations, as well as eliminate the need for sending layer information in each call.</p>
|
||||
|
@ -62,8 +62,8 @@
|
|||
<div class="richcode">
|
||||
<p><a href="/method/invokeAfterMsg">invokeAfterMsg</a>#cb9f372d {X:Type} msg_id:long query:!X = X;<br><a href="/method/invokeAfterMsgs">invokeAfterMsgs</a>#3dc4b4f0 {X:Type} msg_ids:Vector<long> query:!X = X;</p>
|
||||
</div>
|
||||
<p>They may be used, for example, if a client attempts to send accumulated messages after the Internet connection has been restored after being absent for a long time. In this case, the 32-bit number <code>0xcb9f372d</code> must be added before the method number in each call, followed by a 64-bit message identifier, msg_id, which contains the previous call in the queue.<br>The second method is similar, except it takes several messages that must be waited for.</p>
|
||||
<p>If the waiting period exceeds 0.5 seconds (this value may change in the future) and no result has appeared, the method will return the <a href="/api/errors#400-bad-request">400 MSG_WAIT_TIMEOUT</a> error.</p>
|
||||
<p>They may be used, for example, if a client attempts to send accumulated messages after the Internet connection has been restored after being absent for a long time. In this case, the 32-bit number <code>0xcb9f372d</code> must be added before the method number in each call, followed by a 64-bit message identifier, msg_id, which contains the previous request in the queue.<br>The second method is similar, except it takes several messages that must be waited for.</p>
|
||||
<p>If the waiting period exceeds 0.5 seconds (this value may change in the future) and no result has appeared, the method will be executed just the same." => "If the waiting period exceeds 0.5 seconds (this value may change in the future) and no result has appeared, the method will return the <a href="/api/errors#400-bad-request">400 MSG_WAIT_TIMEOUT</a> error.</p>
|
||||
<h4><a class="anchor" name="helper-method-sequence" href="#helper-method-sequence"><i class="anchor-icon"></i></a>Helper Method Sequence</h4>
|
||||
<p><strong>Important:</strong> if the helper methods <strong>invokeAfterMsg</strong> / <strong>invokeAfterMsgs</strong> are used together with <strong>invokeWithLayerN</strong> or other helper methods, <strong>invokeAfterMsg</strong> / <strong>invokeAfterMsgs</strong> must always be the outermost wrapper.</p>
|
||||
<h3><a class="anchor" name="data-compression" href="#data-compression"><i class="anchor-icon"></i></a>Data Compression</h3>
|
||||
|
@ -73,7 +73,7 @@
|
|||
<p>Before transmitting a query, the string containing the entire body of the serialized high-level query (starting with the method number) must be compressed using gzip. If the resulting string is smaller than the original, it makes sense to transmit the <a href="/mtproto/service_messages#pakovannyy-obekt">gzip_packed</a> constructor.</p>
|
||||
<p>There is no point in doing the above when transmitting binary multimedia data (photos, videos) or small messages (up to 255 bytes).</p>
|
||||
<h4><a class="anchor" name="uncompressing-data" href="#uncompressing-data"><i class="anchor-icon"></i></a>Uncompressing Data</h4>
|
||||
<p>By default, the server compresses the response to any call as well as <a href="/api/updates">updates</a>, in accordance with the rules stated above. If the <a href="/mtproto/service_messages#packed-object">gzip_packed</a> constructor is received as a response in rpc_result, then the string that follows must be extracted and uncompressed. Processing then continues on the resulting new string.</p>
|
||||
<p>By default, the server compresses the response to any request as well as <a href="/api/updates">updates</a>, in accordance with the rules stated above. If the <a href="/mtproto/service_messages#packed-object">gzip_packed</a> constructor is received as a response in rpc_result, then the string that follows must be extracted and uncompressed. Processing then continues on the resulting new string.</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue