Skip to content

Commit 5f430c0

Browse files
author
Vítězslav Dvořák
committed
Code usage examples added to README
1 parent 58dcc83 commit 5f430c0

File tree

1 file changed

+43
-13
lines changed

1 file changed

+43
-13
lines changed

README.md

Lines changed: 43 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,24 @@ Takeout API endpoints. You will perform POST requests over HTTPS and then store
1616
resulting data. Most of the Takeout endpoints have just 2 parameters, both required: `login`` and
1717
`password`.
1818

19+
To configure API client please define this Environment variables first:
20+
21+
```env
22+
REALPAD_USERNAME=realpad
23+
REALPAD_PASSWORD=realpad
24+
```
25+
26+
(Configuration mechanism can also use The PHP constants)
27+
1928
Example call in cURL:
2029

21-
```shell
22-
curl \
23-
--data "login=...&password=..." \
24-
--output customers.xls \
25-
https://cms.realpad.eu/ws/v10/list-excel-customers
30+
```php
31+
<?php
32+
\Ease\Shared::init(['REALPAD_USERNAME','REALPAD_PASSWORD'], '../.env');
33+
34+
$client = new \SpojeNet\Realpad\ApiClient();
35+
$responseCode = $client->doCurlRequest($client->baseEndpoint . 'ws/v10/list-resources', 'POST');
36+
$dataObtained = $client->lastCurlResponse;
2637
```
2738

2839
### Response
@@ -32,8 +43,8 @@ https://cms.realpad.eu/ws/v10/list-excel-customers
3243
**list-resources**
3344

3445
```php
46+
<?php
3547
$client = new \SpojeNet\Realpad\ApiClient();
36-
3748
$resources = $client->listResources();
3849
```
3950

@@ -65,17 +76,17 @@ Array
6576
</pre>
6677

6778

68-
● uid is the unique identifier of this resource, by which it can be retrieved using
79+
**uid** is the unique identifier of this resource, by which it can be retrieved using
6980
get-projects.
7081

71-
● content-type is the MIME type of the file, resolved when uploaded to the system (it’s
82+
**content-type** is the MIME type of the file, resolved when uploaded to the system (it’s
7283
the best guess).
7384

74-
● file-name is the original file name when it was uploaded to the system.
85+
**file-name** is the original file name when it was uploaded to the system.
7586

76-
● size is the file size in bytes.
87+
**size** is the file size in bytes.
7788

78-
● crc is the CRC32 checksum of the file.
89+
**crc** is the CRC32 checksum of the file.
7990

8091
This endpoint will always return all the resources. It’s up to your system to determine which
8192
ones you haven’t downloaded yet. You may rely on UID as the unique identifier to distinguish
@@ -100,6 +111,25 @@ data in the Excel newer .xlsx format.
100111
**list-excel-customers**
101112
The last column contains the unique customer ID from the Realpad database.
102113

114+
<pre>
115+
Array
116+
(
117+
[2] => Array
118+
(
119+
[Projekt] => Nove Město 3 - C
120+
[Datum přidání] => 6/20/2017
121+
[Stav] => Postaveno
122+
[E-mail] => [email protected]
123+
[Jméno] => Ukazkovy Zakaznik
124+
[Tagy] =>
125+
[Zákazník ID] => 4268453
126+
[Prodejce ID] => 914756
127+
[Stav ID] => 1
128+
[Zdroj ID] => 12
129+
)
130+
...
131+
</pre>
132+
103133
**list-excel-products**
104134
The last columns contain the unique unit ID, numeric ID of the unit type, numeric ID of the unit
105135
availability, unique project ID and deal ID from the Realpad database. See the appendix for the
@@ -160,11 +190,11 @@ recorded.
160190

161191
**list-excel-invoices**
162192
Accepts several additional optional parameters:
163-
● `filter_status`` - if left empty, invoices in all statuses are sent. 1 - new invoices. 2 -
193+
`filter_status` - if left empty, invoices in all statuses are sent. 1 - new invoices. 2 -
164194
invoices in Review #1. 3 - invoices in Review #2. 4 - invoices in approval. 5 - fully
165195
approved invoices. 6 - fully rejected invoices.
166196

167-
`filter_groupcompany` - if left empty, invoices from all the group companies are sent. If
197+
`filter_groupcompany` - if left empty, invoices from all the group companies are sent. If
168198
Realpad database IDs of group companies are provided (as a comma-separated list),
169199
then only invoices from these companies are sent.
170200

0 commit comments

Comments
 (0)