From e343cbce9ffde6571cef2717e7e62df2367bb641 Mon Sep 17 00:00:00 2001 From: Stavros Papadakis <spapad@gmail.com> Date: Fri, 23 Dec 2016 12:35:07 +0200 Subject: [PATCH] Examples added to readme --- base-php-client/README.md | 252 +++++++++++++++++++++++++++++++++++++- 1 file changed, 249 insertions(+), 3 deletions(-) diff --git a/base-php-client/README.md b/base-php-client/README.md index 3196bf6..00e195d 100644 --- a/base-php-client/README.md +++ b/base-php-client/README.md @@ -14,13 +14,259 @@ ΀ο ΟΟΟΞ³ΟΞ±ΞΌΞΌΞ± Ξ΄ΞΟΞ΅ΟΞ±ΞΉ ΟΞΉΟ ΟΞ±ΟΞ±ΞΊΞ¬ΟΟ ΟΞ±ΟΞ±ΞΌΞΟΟΞΏΟ Ο: ``` -Ξ§ΟΞ�ΟΞ·: index.php [--list] [--listshow] [--send <file>] [--show <hashid>] [--get <hashid>] [--save <hashid>] - list: λίΟΟΞ± hashids ΟΟΞ½ ΡγγΟΞ¬ΟΟΞ½ - listshow: λίΟΟΞ± Ξ±ΟΟΡίΟΞ½ +Ξ§ΟΞ�ΟΞ·: index.php [-v] [--list] [--listshow] [-i|-o] [--send <file>] [--attach <file>] [--show <hashid>] [--get <hashid>] [--save <hashid>] + v: ΟΞ±ΟΞ±Ξ³ΟΞ³Ξ� ΞΌΞ·Ξ½Ο ΞΌΞ¬ΟΟΞ½ ΟΞ±ΟακολοΟΞΈΞ·ΟΞ·Ο Ξ΅ΞΊΟΞλΡΟΞ·Ο + list: λίΟΟΞ± hashids ΟΟΞ½ ΡγγΟΞ¬ΟΟΞ½ (ΟΟΞ½ ΟΞ΅Ξ»Ξ΅Ο ΟΞ±Ξ―ΟΞ½ 5 Ξ·ΞΌΞ΅ΟΟΞ½) + listshow: λίΟΟΞ± Ξ±ΟΟΡίΟΞ½ (ΟΟΞ½ ΟΞ΅Ξ»Ξ΅Ο ΟΞ±Ξ―ΟΞ½ 5 Ξ·ΞΌΞ΅ΟΟΞ½) + i: Ξ½Ξ± ΟΟ ΞΌΟΞ΅ΟιληΟΞΈΞΏΟΞ½ ΞΌΟΞ½ΞΏ ΟΞ± ΡιΟΞ΅ΟΟΟμΡνα ΟΟΞ· λίΟΟΞ± Ξ±ΟΟΡίΟΞ½ + ΞΏ: Ξ½Ξ± ΟΟ ΞΌΟΞ΅ΟιληΟΞΈΞΏΟΞ½ ΞΌΟΞ½ΞΏ ΟΞ± ΡξΡΟΟΟμΡνα ΟΟΞ· λίΟΟΞ± Ξ±ΟΟΡίΟΞ½ send <file>: ΞΊΞ±ΟΞ±ΟΟΟΞ·ΟΞ· ΟΟΟΟΞΏΞΊΟΞ»Ξ»ΞΏΟ ΞΌΞ΅ Ξ±ΟΞΏΟΟΞΏΞ»Ξ� ΟΞΏΟ Ξ±ΟΟΞ΅Ξ―ΞΏΟ file +attach <file>: Ξ΅ΟΞΉΟΟΞ½Ξ±ΟΞ· Ξ±ΟΟΞ΅Ξ―ΞΏΟ ΟΟΞ·Ξ½ ΞΊΞ±ΟΞ±ΟΟΟΞ·ΟΞ· (ΟολλαΟΞ»Ο) show <hash>: Ξ±Ξ½Ξ±Ξ»Ο ΟΞΉΞΊΞΟ ΟληΟΞΏΟΞΏΟΞ―Ξ΅Ο Ξ±ΟΟΞ΅Ξ―ΞΏΟ ΞΌΞ΅ δΡδομΞΞ½ΞΏ hashid get <hash>: Ξ»Ξ�ΟΞ· Ξ±ΟΟΞ΅Ξ―ΞΏΟ ΞΌΞ΅ δΡδομΞΞ½ΞΏ hashid save <hash>: Ξ»Ξ�ΟΞ· ΞΊΞ±ΞΉ Ξ±ΟΞΏΞΈΞ�ΞΊΞ΅Ο ΟΞ· Ξ±ΟΟΞ΅Ξ―ΞΏΟ ΞΌΞ΅ δΡδομΞΞ½ΞΏ hashid ΟΟΞΏΞ½ ΟΟΞΟΞΏΞ½ΟΞ± ΟάκΡλο ΞΊΞ±ΞΉ ΞΌΞ΅ ΟΞΏ ΟΞ½ΞΏΞΌΞ± Ξ±ΟΟΞ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3D%3D +OblOuYKCQEdnwH1PFBstxA%3D%3D +rSOTUDYNkHWBDktlAP31Hg%3D%3D +Done. +``` + +**Ξ Ξ±ΟάδΡιγμα ΞΌΞ΅ verbose output** + +```sh +$ php index.php --list -v +ΞνάκΟΞ·ΟΞ· API key... +getApiKey :: payload: {"username":"test","password":"123456"} +* Trying 195.251.16.162... +* Connected to protocoltest.minedu.gov.gr (195.251.16.162) port 443 (#0) +* ALPN, offering http/1.1 +* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH +* successfully set certificate verify locations: +* CAfile: /etc/ssl/certs/ca-certificates.crt + CApath: /etc/ssl/certs +* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384 +* ALPN, server did not agree to a protocol +* Server certificate: +* subject: C=GR; ST=Athens; L=Maroussi; O=Greek Ministry of Education; OU=IT; CN=protocoltest.minedu.gov.gr +* start date: Aug 5 00:00:00 2016 GMT +* expire date: Aug 14 12:00:00 2019 GMT +* subjectAltName: protocoltest.minedu.gov.gr matched +* issuer: C=NL; ST=Noord-Holland; L=Amsterdam; O=TERENA; CN=TERENA SSL CA 3 +* SSL certificate verify ok. +> PUT /openpapyros/api/pauthenticate/pauth HTTP/1.1 +Host: protocoltest.minedu.gov.gr +User-Agent: OSTEAM barebone php client +Content-Type: application/json +Accept: application/json +Content-Length: 39 + +* upload completely sent off: 39 out of 39 bytes +< HTTP/1.1 200 OK +< Date: Fri, 23 Dec 2016 10:33:51 GMT +< Server: Apache +< X-Powered-By: Modus/Undertow/1 +< Content-Type: application/json +< Content-Length: 101 +< Vary: Accept-Encoding +< +* Connection #0 to host protocoltest.minedu.gov.gr left intact +΀ο API key Ρίναι: eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiIxMDAwMDAwIn0.X6fRd7StTnSIq11S7IpjaMSTP3540ypEfXV6sJRWujk +ΞνάκΟΞ·ΟΞ· λίΟΟΞ±Ο Ξ΅Ξ³Ξ³ΟΞ¬ΟΟΞ½... +searchDocuments :: payload: {"senderId":100000001,"docType":null,"startDate":"2016-12-18T00:00:00+02:00","endDate":"2016-12-23T12:33:52+02:00"} +* Hostname protocoltest.minedu.gov.gr was found in DNS cache +* Trying 195.251.16.162... +* Connected to protocoltest.minedu.gov.gr (195.251.16.162) port 443 (#0) +* ALPN, offering http/1.1 +* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH +* successfully set certificate verify locations: +* CAfile: /etc/ssl/certs/ca-certificates.crt + CApath: /etc/ssl/certs +* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384 +* ALPN, server did not agree to a protocol +* Server certificate: +* subject: C=GR; ST=Athens; L=Maroussi; O=Greek Ministry of Education; OU=IT; CN=protocoltest.minedu.gov.gr +* start date: Aug 5 00:00:00 2016 GMT +* expire date: Aug 14 12:00:00 2019 GMT +* subjectAltName: protocoltest.minedu.gov.gr matched +* issuer: C=NL; ST=Noord-Holland; L=Amsterdam; O=TERENA; CN=TERENA SSL CA 3 +* SSL certificate verify ok. +> POST /openpapyros/api/search/documents HTTP/1.1 +Host: protocoltest.minedu.gov.gr +User-Agent: OSTEAM barebone php client +api_key: eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiIxMDAwMDAwIn0.X6fRd7StTnSIq11S7IpjaMSTP3540ypEfXV6sJRWujk +Content-Type: application/json +Accept: application/json +Content-Length: 115 + +* upload completely sent off: 115 out of 115 bytes +< HTTP/1.1 200 OK +< Date: Fri, 23 Dec 2016 10:33:52 GMT +< Server: Apache +< X-Powered-By: Modus/Undertow/1 +< Content-Type: application/json +< Content-Length: 740 +< Vary: Accept-Encoding +< +* Connection #0 to host protocoltest.minedu.gov.gr left intact +ΞΞ―ΟΟΞ± ΡγγΟΞ¬ΟΟΞ½: +Bl5BEZPKGztl2lcmtEWMgQ%3D%3D +r%2BhOqWinF8U%2FPKM6RDn45g%3D%3D +ai2nYtQPsm5iWacd1NEEYw%3D%3D +69t%2FYlgsEJjQMiWkPUFpFQ%3D%3D +XJL2Whs6%2FBsu6ObQ%2FpeMlw%3D%3D +QiQ8VaRYeItETkqP%2FKjTVQ%3D%3D +ELTKEUX%2B0FLyivlIm%2Bm0uw%3D%3D +OrDAz8L9tF0AGSGutQ0Hxw%3D%3D +lmyplemnNoaMR0W6TU0uqg%3D%3D +%2F%2FvoXi7pZMVHdFvVlTTLGQ%3D%3D +GHotM8CWL%2FvGPjabwzHhqg%3D%3D +NU6CEaLymbOjqzla1iSuyQ%3D%3D +22UMz%2B55qhqJhy2AL0Ihtg%3D%3D +vhX1LPAxgI8VTHpXrXzNIQ%3D%3D +tbAP3jdzbrj%2BtB9prn1s2w%3D%3D +1Lph6VjgxqRjVhiyMNNgTg%3D%3D +L3Wwrt54uCCyAqoCN51enA%3D%3D +HN9eLwiPjsKncOxfWsFlKw%3D%3D +RLjZIIroC0WTWARa8iPxjw%3D%3D +IFFnDJWBuWhtpQhvlzPyMQ%3D%3D +K7ga1NQ2wONXb3364Q9Elg%3D%3D +OblOuYKCQEdnwH1PFBstxA%3D%3D +rSOTUDYNkHWBDktlAP31Hg%3D%3D +Done. +``` + +### Ξ ΟΟΟΞΏΞΊΟλληΟΞ· ΡγγΟΞ¬ΟΞΏΟ + +**ΞΞ΅ ΟΟ Ξ½Ξ·ΞΌΞΌΞΞ½ΞΏ Ξ±ΟΟΡίο** + +```sh +$ php index.php --send /tmp/test-file2.pdf --attach /tmp/test-file.pdf +ΞνάκΟΞ·ΟΞ· API key... +΀ο API key Ρίναι: eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiIxMDAwMDAwIn0.-5lgafnO-ACRSchNQQhUpx8RfuZnGQtvF9-eIl9EJsY +ΞΟΞΏΟΟΞΏΞ»Ξ� ΡγγΟΞ¬ΟΞΏΟ ... +ΞλΡγΟΞΏΟ Ξ³ΞΉΞ± ΟΞΏ Ξ±ΟΟΡίο /tmp/test-file2.pdf... OK +ΞλΡγΟΞΏΟ Ξ³ΞΉΞ± ΟΞΏ ΟΟ Ξ½Ξ·ΞΌΞΌΞΞ½ΞΏ Ξ±ΟΟΡίο /tmp/test-file.pdf... OK +Ξ Ξ±ΟΞΏΟΟΞΏΞ»Ξ� ολοκληΟΟΞΈΞ·ΞΊΞ΅ ΞΌΞ΅ ΞΞ‘.Ξ .: 180042 +ΞΞ½Ξ±Ξ»Ο ΟΞΉΞΊΞ¬: Array +( + [docId] => rSOTUDYNkHWBDktlAP31Hg%3D%3D + [protocolYear] => 2016 + [protocolDate] => 23/12/2016 + [protocolNumber] => 180042 + [attachments] => Array + ( + [0] => Array + ( + [docId] => 7Kv7cp7J5fQRXyw7R1mEGQ%3D%3D + [description] => + ) + + ) + +) + +Done. +``` + +### ΞΞ΅ΟΟΞΏΞΌΞΟΞ΅ΞΉΞ΅Ο ΟΟΟΟΞΏΞΊΟΞ»Ξ»ΞΏΟ + +```sh +$ php index.php --show "rSOTUDYNkHWBDktlAP31Hg%3D%3D" +ΞνάκΟΞ·ΟΞ· API key... +΀ο API key Ρίναι: eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiIxMDAwMDAwIn0.UD9kmeoxUiytUiKBuq6ckeRkwlGoBmwLETlpNdtbX7Q +ΞΞ΅ΟΟΞΏΞΌΞΟΞ΅ΞΉΞ΅Ο Ξ΅Ξ³Ξ³ΟΞ¬ΟΞΏΟ : +Array +( + [id] => rSOTUDYNkHWBDktlAP31Hg%3D%3D + [protocolNumber] => 180042 + [protocolDate] => 23/12/2016 + [docType] => 7 + [sender] => 100000001 + [senderProtocol] => + [senderDateProtocol] => + [docCategory] => 20 + [theme] => ΞΞΞΞΞΞ: ΞΟ ΟΞΏΞΌΞ±ΟΞΏΟΞΏΞΉΞ·ΞΌΞΞ½ΞΏ κΡίμΡνο ΟΞ·Ο 2016-12-23T12:27:06+02:00 + [ada] => + [attachedDocsDescr] => ΞΞΞΞΞΞ: ΞΟ ΟΞΏΞΌΞ±ΟΞΏΟΞΏΞΉΞ·ΞΌΞΞ½ΞΏ κΡίμΡνο ΟΞ΅ΟΞΉΞ³ΟΞ±ΟΞ�Ο 20161223121227 + [director] => ΞΞΞΞΞΞ: ΞΟ ΟΞΏΞΌΞ±ΟΞΏΟΞΏΞΉΞ·ΞΌΞΞ½ΞΏ κΡίμΡνο ΟΞ΅ΟΞΉΞ³ΟΞ±ΟΞ�Ο 20161223121227 + [attachedId] => Array + ( + [0] => 7Kv7cp7J5fQRXyw7R1mEGQ%3D%3D + ) + +) + +Done. +``` + +### ΠληΟΞΏΟΞΏΟΞ―Ξ΅Ο Ξ±ΟΟΞ΅Ξ―ΞΏΟ + +```sh +$ php index.php --get "rSOTUDYNkHWBDktlAP31Hg%3D%3D" +ΞνάκΟΞ·ΟΞ· API key... +΀ο API key Ρίναι: eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiIxMDAwMDAwIn0.S70EW5ruMkAzxg4QaY0izZj0xSF_jeRrTvMiOf7DC10 +ΞΞ΅ΟΟΞΏΞΌΞΟΞ΅ΞΉΞ΅Ο Ξ΅Ξ³Ξ³ΟΞ¬ΟΞΏΟ : +Array +( + [document] => Array + ( + [base64] => go= + ) + + [fileName] => test-file2.pdf + [description] => ΞΞΞ£ - 180042 - 2016 +) + +Done. + +``` + +### ΞΞ�ΟΞ· Ξ±ΟΟΞ΅Ξ―ΞΏΟ + +```sh +$ php index.php --save "7Kv7cp7J5fQRXyw7R1mEGQ%3D%3D" +ΞνάκΟΞ·ΟΞ· API key... +΀ο API key Ρίναι: eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiIxMDAwMDAwIn0.WLTS9UxlPDZw-1WsjWush7HXzYWRjazJMEYR8Q58mjo +ΞΞ΅ΟΟΞΏΞΌΞΟΞ΅ΞΉΞ΅Ο Ξ±ΟΞΏΞΈΞ�ΞΊΞ΅Ο ΟΞ·Ο Ξ΅Ξ³Ξ³ΟΞ¬ΟΞΏΟ : +Array +( + [file_name] => test-file.pdf + [description] => ΞΞΞΞΞΞ: ΞΟΞΏΟΟΞΏΞ»Ξ� ΟΟ Ξ½Ξ·ΞΌΞΌΞΞ½ΞΏΟ Ξ΄ΞΏΞΊΞΉΞΌΞ±ΟΟΞΉΞΊΞΏΟ Ξ±ΟΟΞ΅Ξ―ΞΏΟ /tmp/test-file.pdf + [save] => ΞΟΞΏΞΈΞ·ΞΊΞ΅ΟΟΞ·ΞΊΞ΅ +) + +Done. +``` -- GitLab