Skip to content

Commit 45bb90d

Browse files
committed
Update Examples
1 parent 8635dde commit 45bb90d

File tree

4 files changed

+39
-42
lines changed

4 files changed

+39
-42
lines changed

examples/adresse-read-filter.php

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
<?php
2-
require_once __DIR__ . '/../vendor/autoload.php'; //Subdirectory --> /../
32

4-
use RestAPIWrapperProffix\RestAPIWrapperProffix;
3+
require __DIR__ . '/vendor/autoload.php';
54

6-
$config = array(
7-
'api_user' => 'SP',
8-
'api_password' => 'b62cce2fe18f7a156a9c719c57bebf0478a3d50f0d7bd18d9e8a40be2e663017',
9-
'api_database' => 'DEMO',
10-
'api_url' => 'https://restapi.myserver.ch:123/pxapi/v2/',
11-
'api_modules' => 'ADR'
12-
);
5+
use Pitwch\RestAPIWrapperProffix\Client;
136

14-
$rest = new RestAPIWrapperProffix($config);
15-
$read = $rest->Get("ADR/Adresse",'Vorname@="Max"'); // Query for all adresses which Vorame contains "Max"
7+
$pxrest = new Client(
8+
'https://myserver.ch:999',
9+
'DEMO',
10+
'USR',
11+
'b62cce2fe18f7a156a9c719c57bebf0478a3d50f0d7bd18d9e8a40be2e663017',
12+
'ADR,STU',
13+
array('key'=>'112a5a90fe28b23ed2c776562a7d1043957b5b79fad242b10141254b4de59028','limit'=>1));
1614

17-
foreach ($read as $adresse) {
18-
echo $adresse->Name." ".$adresse->Vorname."\n"; // Echo Name + Vorname + newline
15+
$adressefilter = $pxrest->Get("ADR/Adresse",array('filter'=>'Vorname@="Max"')); // Query for all adresses + Vorname contains "Max"
16+
17+
foreach ($adressefilter as $adresse) {
18+
echo $adresse->Name." ".$adresse->Vorname."\n"; // Echo Name + Vorname + newline
1919
}
2020

2121

examples/adresse-read.php

+15-17
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
1-
<?php
2-
require_once __DIR__ . '/../vendor/autoload.php'; //Subdirectory --> /../
1+
<?
32

4-
use RestAPIWrapperProffix\RestAPIWrapperProffix;
3+
require __DIR__ . '/vendor/autoload.php';
54

6-
$config = array(
7-
'api_user' => 'SP',
8-
'api_password' => 'b62cce2fe18f7a156a9c719c57bebf0478a3d50f0d7bd18d9e8a40be2e663017',
9-
'api_database' => 'DEMO',
10-
'api_url' => 'https://restapi.myserver.ch:123/pxapi/v2/',
11-
'api_modules' => 'ADR',
12-
'api_key' => '112a5a90fe28b23ed2c776562a7d1043957b5b79fad242b10141254b4de59028',
13-
'enable_log' => true,
14-
'log_path' => ''
15-
);
5+
use Pitwch\RestAPIWrapperProffix\Client;
166

17-
$rest = new RestAPIWrapperProffix($config);
18-
$login = $rest->Get("ADR/Adresse/1");
7+
$pxrest = new Client(
8+
'https://myserver.ch:999',
9+
'DEMO',
10+
'USR',
11+
'b62cce2fe18f7a156a9c719c57bebf0478a3d50f0d7bd18d9e8a40be2e663017',
12+
'ADR,STU',
13+
array('key'=>'112a5a90fe28b23ed2c776562a7d1043957b5b79fad242b10141254b4de59028','limit'=>1));
1914

20-
echo $login->Name; // returns Name of Adress 1
15+
16+
$adressen = $pxrest->get('ADR/Adresse',array('filter'=>'GeaendertAm>d\'2018-05-17 14:54:56\'','depth'=>1,'fields'=>'AdressNr,Name,PLZ,Ort'));;
17+
18+
echo $adressen->AdressNr; // returns Name of Adress
2119
echo "\n"; // new line
22-
echo $login->PLZ." ".$login->Ort; // returns PLZ + Ort of Adress 1
20+
echo $adressen->PLZ." ".$adressen->Ort; // returns PLZ + Ort of Adress

examples/adresse-update.php

+10-11
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
<?php
2-
require_once __DIR__ . '/../vendor/autoload.php'; //Subdirectory --> /../
32

4-
use RestAPIWrapperProffix\RestAPIWrapperProffix;
3+
require __DIR__ . '/vendor/autoload.php';
54

6-
$config = array(
7-
'api_user' => 'SP',
8-
'api_password' => 'b62cce2fe18f7a156a9c719c57bebf0478a3d50f0d7bd18d9e8a40be2e663017',
9-
'api_database' => 'DEMO',
10-
'api_url' => 'https://restapi.myserver.ch:123/pxapi/v2/',
11-
'api_modules' => 'ADR'
12-
);
5+
use Pitwch\RestAPIWrapperProffix\Client;
136

14-
$rest = new RestAPIWrapperProffix($config);
7+
$pxrest = new Client(
8+
'https://myserver.ch:999',
9+
'DEMO',
10+
'USR',
11+
'b62cce2fe18f7a156a9c719c57bebf0478a3d50f0d7bd18d9e8a40be2e663017',
12+
'ADR,STU',
13+
array('key'=>'112a5a90fe28b23ed2c776562a7d1043957b5b79fad242b10141254b4de59028','limit'=>1));
1514

1615
$post = array(
1716
"Name" => "Muster GmbH",
@@ -20,5 +19,5 @@
2019
);
2120

2221

23-
$post = $rest->Update("ADR/Adresse/1",$post);
22+
$post = $pxrest->post("ADR/Adresse/1",$post);
2423
// Updates Adress 1 with Name = Muster GmbH, Ort = Zürich,PLZ = 8000

src/RestAPIWrapperProffix/Client.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
class Client
1010
{
1111

12-
const VERSION = '1.2.0';
12+
const VERSION = '1.3';
1313

1414

1515
public $http;

0 commit comments

Comments
 (0)