Skip to content
This repository was archived by the owner on Apr 13, 2025. It is now read-only.

Commit 3fc6a4d

Browse files
readme updated
1 parent 5c11689 commit 3fc6a4d

File tree

1 file changed

+42
-2
lines changed

1 file changed

+42
-2
lines changed

README.md

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ This library is ready for production usage, all source codes provided "as is".
1818

1919
About [migration to 1.8](https://github.com/DrTeamRocks/uon/wiki/Миграция-с-1.7-(и-ниже)-на-1.8-(и-выше)).
2020

21-
## Example of usage
21+
## How to use
2222

23+
### Basic example
2324
```php
2425
<?php
2526
require_once __DIR__ . "/../vendor/autoload.php";
@@ -54,7 +55,7 @@ All available methods of all classes with descriptions you can find [here](READM
5455
* verify - Content verification
5556
* cookies - Use cookies
5657

57-
Additional parameters for error 429
58+
Additional parameters for "Error 429: Too many requests"
5859

5960
* tries - Count of tries if server answer 429 error code (default: 10)
6061
* seconds - Time which need wait between tries (default: 1)
@@ -67,6 +68,45 @@ $config
6768
->set('seconds', 2);
6869
```
6970

71+
### About the page
72+
73+
Some GET methods have a `$page` parameter (with default state `1`),
74+
and you can get only `100` items for one time it `$page` parameter is exist.
75+
76+
List of endpoints which have a `$page` parameter.
77+
78+
* /catalog-service/
79+
* /cities/
80+
* /hotels/
81+
* /leads/$date_from/$date_to/
82+
* /leads/$date_from/$date_to/$id_sources/
83+
* /lead-by-client/$id_lead/
84+
* /payment/list/
85+
* /request-action/
86+
* /requests/updated/
87+
* /suppliers/
88+
* /users/
89+
* /user/updated/
90+
91+
These (I mean `$page`) parameter was added by API developers to reduce
92+
the load on the server. So, do not worry if you see only 100 items in
93+
result messages you just need write loop to get all items from API,
94+
like this:
95+
96+
```
97+
$i=1;
98+
while (true) { // yeah, I know it's bad, better to use recursion
99+
$response = $uon->requests->get($i);
100+
$results[] = $response;
101+
// Exit from loop if less than 100 items in answer from server
102+
if (count($response->message) < 100) {
103+
break;
104+
}
105+
$i++;
106+
}
107+
print_r($results);
108+
```
109+
70110
## How to get API token
71111

72112
You need login into your account, then go to the

0 commit comments

Comments
 (0)