Commit f3af22b8 authored by Valentin Skripnikov's avatar Valentin Skripnikov

-

parent 2416d912
...@@ -386,26 +386,30 @@ REST API ARTA Synergy доступно только авторизованным ...@@ -386,26 +386,30 @@ REST API ARTA Synergy доступно только авторизованным
Пример кода на JAVA: Пример кода на JAVA:
.. code-block:: java .. code-block:: java
:emphasize-lines: 2 :emphasize-lines: 5
HttpResponse<String> response = Unirest.post("https://demo.arta.kz/Synergy/rest/api/report/do?reportID=daa64ab2-1a79-4ea2-9c24-372e35d9da3e&fileName=report.pdf") String login = "Administrator";
.header("authorization", "Basic QWRtaW5pc3RyYXRvcjoxMjM0NTY=") String password = "123456";
.header("cache-control", "no-cache")
HttpResponse<String> response = Unirest.get("http://demo.arta.kz/Synergy/rest/api/admin/db/current_version")
.header("authorization", Base64.getEncoder().encodeToString((login + ":" + password).getBytes("UTF‌​-8")))
.asString(); .asString();
Пример кода на JavaScript (jQuery): Пример кода на JavaScript (jQuery):
.. code-block:: js .. code-block:: js
:emphasize-lines: 7 :emphasize-lines: 10
var login = "Administrator";
var password = "123456";
var settings = { var settings = {
"async": true, "async": true,
"crossDomain": true, "crossDomain": true,
"url": "https://demo.arta.kz/Synergy/rest/api/report/do?reportID=daa64ab2-1a79-4ea2-9c24-372e35d9da3e&fileName=report.pdf", "url": "http://demo.arta.kz/Synergy/rest/api/admin/db/current_version",
"method": "POST", "method": "GET",
"headers": { "headers": {
"authorization": "Basic QWRtaW5pc3RyYXRvcjoxMjM0NTY=", "authorization": ("Basic " + btoa(login + ":" + password))
"cache-control": "no-cache"
} }
} }
...@@ -416,22 +420,19 @@ REST API ARTA Synergy доступно только авторизованным ...@@ -416,22 +420,19 @@ REST API ARTA Synergy доступно только авторизованным
Пример кода на PHP: Пример кода на PHP:
.. code-block:: php .. code-block:: php
:emphasize-lines: 14 :emphasize-lines: 8
<?php <?php
$request = new HttpRequest(); $login = "Administrator";
$request->setUrl('https://demo.arta.kz/Synergy/rest/api/report/do'); $password = "123456"
$request->setMethod(HTTP_METH_POST);
$request->setQueryData(array( $request = new HttpRequest();
'reportID' => 'daa64ab2-1a79-4ea2-9c24-372e35d9da3e', $request->setUrl('http://demo.arta.kz/Synergy/rest/api/admin/db/current_version');
'fileName' => 'report.pdf' $request->setMethod(HTTP_METH_GET);
));
$request->setHeaders(array( $request->setHeaders(array(
'cache-control' => 'no-cache', 'authorization' => "Basic " . base64_encode("$login:$password")
'authorization' => 'Basic QWRtaW5pc3RyYXRvcjoxMjM0NTY='
)); ));
try { try {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment