[Progress Communities] [Progress OpenEdge ABL] Forum Post: RE: Render Telerik Report from my ABL program

  • Thread starter Dmitry Lishafaev
  • Start date
Status
Not open for further replies.
D

Dmitry Lishafaev

Guest
Thanks for replying. I've tried also Telerik Report Server. He has REST API and should be simple in comparison with .Net/DLL call. But how I can get auth token? Link Javascript code found in documentation. How I can do this with OpenEdge? I got HTTP 400, Bad Request USING OpenEdge.Net.HTTP.*. USING OpenEdge.Net.Uri. USING Progress.Json.ObjectModel.*. USING OpenEdge.Core.STRING. SESSION:DEBUG-ALERT=YES. log-manager:logfile-name = 'c:\dev\get_applications.log'. log-manager:logging-level = 6. log-manager:clear-log(). DEF VAR crJson AS Progress.Json.ObjectModel.JsonObject NO-UNDO. DEF VAR oRequest AS IHttpRequest NO-UNDO. DEF VAR oResponse AS IHttpResponse NO-UNDO. DEF VAR oURI AS URI NO-UNDO. crJson = NEW JsonObject(). crJson:add('grant_type',"password"). crJson:add('username',"dmi"). crJson:add('password',"1123"). oURI = NEW URI('http','armor',83). /* http://armor:83 - report server instance */ oURI:path = 'Token'. oRequest = RequestBuilder:Build('POST', oURI) :AcceptJson() :WithData(crJson) :Request. oResponse = ClientBuilder:Build():Client:Execute(oRequest). IF oResponse:StatusCode <> 200 THEN MESSAGE 'Request Error: ' + STRING(oResponse:StatusCode). ELSE CAST(oResponse:Entity, JsonObject):WriteFile('c:\dev\response.json', TRUE). My request is POST /Token HTTP/1.1 User-Agent: OpenEdge-HttpClient/0.4.0 (WIN32/64) OpenEdge/11.7.4.0.1685 Lib-ABLSockets/0.5.0 Host: armor:83 Content-Type: application/json Content-Length: 74 Accept: application/json { "grant_type": "password", "username": "dmi", "password": "1123" } and answer ================================ NEW CHUNK (8192) BYTES READ (272) ================================ HTTP/1.1 400 Bad Request Cache-Control: no-cache Pragma: no-cache Content-Type: application/json;charset=UTF-8 Expires: -1 Server: Microsoft-IIS/10.0 X-Powered-By: ASP.NET Date: Wed, 08 May 2019 17:38:06 GMT Content-Length: 34 {"error":"unsupported_grant_type"} Can anybody provide to me curl example to get token?

Continue reading...
 
Status
Not open for further replies.
Top