Both sides previous revision Previous revision Next revision | Previous revision |
kb:api_auth [2024/11/13 11:51] – ognjen.bogicevic | kb:api_auth [2024/11/20 10:20] (current) – ognjen.bogicevic |
---|
====== Generisanje tokena ====== | ====== Generisanje tokena ====== |
| |
Generisanje sesijskog tokena koristi se pri pozivu metoda za prikaz ili izmenu podataka u sistemu. | Generisanje sesijskog tokena koristi se pri pozivu metoda za prikaz ili izmenu podataka u sistemu.\\ |
API zahtev dostupan je u SOAP i REST formatima podataka. Za oba formata istu su nazivi i tipovi atributa samo je drugačija struktura podataka XML i JSON. | API zahtev dostupan je u SOAP i REST formatima podataka.\\ |
| Za oba formata istu su nazivi i tipovi atributa samo je drugačija struktura podataka XML ili JSON.\\ |
| Sve opisane status kodove možete pronaći na [[:kb:web_api:http_codes|HTTP status kodovi]]. |
| |
===== Zahtev ===== | ===== Zahtev ===== |
==== REST ==== | |
| === REST Endpoint === |
<code> | <code> |
POST https://ws.melany.rs/api/rest/auth | POST https://ws.melany.rs/api/rest/auth |
</code> | </code> |
| |
==== SOAP ==== | === SOAP Endpoint === |
<code> | <code> |
POST https://ws.melany.rs/api/soap/auth | POST https://ws.melany.rs/api/soap/auth |
| |
==== Ulazni parametri ==== | ==== Ulazni parametri ==== |
| |
^Naziv^Tip^Obavezno^Opis^Revizija| | ^Naziv^Tip^Obavezno^Opis^Revizija| |
|username|String|Obavezno polje|Korisničko ime koje se koristi za autentifikaciju.|24-11-13| | |username|String|Obavezno polje|Korisničko ime koje se koristi za autentifikaciju.|24-11-13| |
| |
=== REST Zahtev === | === REST Zahtev === |
| |
<code> | <code> |
| |
POST https://ws.melany.rs:8191/LogIn/LogIn HTTP/1.1 | curl -X 'POST' \ |
Accept-Encoding: gzip,deflate | 'https://ws.melany.rs/api/rest/auth' \ |
Content-Type: text/xml;charset=UTF-8 | -H 'accept: application/json' \ |
SOAPAction: "" | -H 'Content-Type: application/json' \ |
| -d '{ |
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://services.bort.com/"> | "username": "melany", |
<soapenv:Header/> | "password": "password", |
<soapenv:Body> | "duration": 0, |
<ser:GetToken> | "company": 10 |
<companyCode>1</companyCode> | }' |
<userName>Nalog</userName> | |
<userCode>sifra_naloga</userCode> | |
<sessLen>20</sessLen> | |
<authCustomer>nalog_komitenta</authCustomer> | |
<authUser>balans_nalog</authUser> | |
</ser:GetToken> | |
</soapenv:Body> | |
</soapenv:Envelope> | |
| |
</code> | </code> |
| |
<code> | <code> |
HTTP/1.1 200 OK | { |
Server: GlassFish Server Open Source Edition 4.1.2 | "code": "eyJjdHkiOiJKV1QiLCJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkEyNTZHQ00ifQ.gI21vCXCCrQms35AWsEj_C5xYDhn_23Sdmbd-J1mx4tQkAqAsLG2JgwQSKaMHcNfHA0pKSFJ5q_9uf-zhRRX0KzCvo6-ZLrqpb6UccIRSGIrCXtFUtRKGPX2g6ruqhj2S7IMoGavisGP7C4xaYkD3KjM5obXvWaEgphBlvotGk8D2z9GbtgVNKGpTyX5JLvceUo4FGFWHtHlXwEYtLAFi8BP_gD0BkCspXEra9CdGx7JS-hwKDzbDmtVH1NoOAMdMpk0SySjay_TNrj-qCx7UuHkusqumgA2aoWWz-W_HEy6KJnRw-nQjBYsz3hm380QI4-leusaaCt-hXAQc7gWpQ.cfFmJD-9FdeM7uS8.BegAuobF5oQuNyDAsWIFUx_kW7Tb4fyGjXAbyTNRQHIRuufZqNJAGBubkqw0zmY9M5Opmk8INy057U0PbtSOWfv9s5PC2cIGyqLpNa4L8X3o_E-ID_W0R1acX5f9QFv1iQA9YXUG9OBZ1stn6fP7wjO-YpAWZEQFkj45Mnjwp2P1cB63BO3GX8l26qKkP7dvcH_-y8aJ6DtBle0zVm0HZmtipaU5rfN0-U13ffEG9RXe0pUWyBngwRe6ZLEca2pe9NUNllFUtiUnuoe_P4qZ2797Ocvrlx7r8wzAzfvzMNYzFWLXweKjN4Zfp5eeH7DVVBJ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3 (GlassFish Server Open Source Edition 4.1.2 Java/Oracle Corporation/1.8) | "expires": "2024-11-14 12:53:24" |
Server: grizzly/2.3.23 | } |
Content-Type: text/xml; charset=utf-8 | |
Transfer-Encoding: chunked | |
| |
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> | |
<S:Body> | |
<ns2:GetTokenResponse xmlns:ns2="http://services.bort.com/"> | |
<return>20010110091424109009</return> | |
</ns2:GetTokenResponse> | |
</S:Body> | |
</S:Envelope> | |
| |
</code> | </code> |
| |
| |
==== REST ==== | |
| |
=== Zahtev === | |
| |
<code>https://ws.melany.rs:8191/BortApp-war/rs/login/gettoken?id=balans_username&pwd=balans_password&len=30</code> | |
| |
Napomena: Ukoliko //username// ili //password// sadrže komandne karaktere URL-a (''&'',''+'',''='') neophodno ih je zameniti ANSI kodom. | |
| |
^Karakter^Kod| | |
|+|%2B| | |
|&|%26| | |
|=|%3D| | |
| |
=== Odgovor === | |
| |
^HTTP kod^Opis^Revizija| | |
|200 OK|Dobija se token u formi //application/json//, npr. ''{"token" : "1712201622047865"}'' |19-6-11| | |
|401 Not Authorized|Dobija se tekst greške u //application/json// zapisu|19-6-11| | |
|500 Server Error|Bilo koji drugi tip greške u //application/json// zapisu|19-6-11| | |
| |
\\ | |
| |
| |