Special Character API


Made a request for API REST.

Using HTTP Request adapter.

Adapter As EnsLib.HTTP.OutboundAdapter

Outside the Ensemble an API response is JSON (CORRECT)

Answer in Ensemble: =?Á

ÔºQZéýNÕ V{C?óò?b¢?éÍ )$ 
²5Å?wEë? ??©tÖã1z×2FëÊnôeË æ??]Zßq ܺ?á

Help me.

Thank you

  • 0
  • 116
  • 8
  • 2


That looks like GZIP. Can you save response stream as a file and reopen it as a %Stream.FileCharacterGzip?


Set tHttpRequest = ##Class(%Net.HttpRequest).%New()

Set tHttpRequest.ContentType = "application/json" 

Set ..Adapter.HTTPServer = "url.example.com.br"

Set ..Adapter.SSLConfig  = "SSL"

Set ..Adapter.ProxyHTTPS = 1

Set ..Adapter.URL        = "/test/api/test/test"

Set tStringJSON = "{""t"":""IWESJ7/aZAurD2xnBALbQ4TAkZkitaw86mSEcOCoq2kFqdtPYBPbRjufNcT8YSmYmh6Riy9XlHUjX89RoIiqMxuUlPHeTloCpDULKrfybA3kcOiPmJn3Nc5y4IxODS+QA/qSs17iC7ts2cKorAY1jlDkLHYrep4cNXnvRNRoclu8cXWxtj8tE3ChrB4lDHmTwW6HZIUFSjphe4gCFF39jRB4VKFCLvtbT5MwvfVo2uNbHbJQGf+dSqRt/Tx7zFNmFlUi/vl0EuW6xCEWvsD85r9sApBbG8eX4axg1TcoeMV00FPjiRiGCn/NIdSMyNC/dIDbl69D9t1dgkhRtDY4ZA=="", ""page"": ""1"", ""onlyActives"": ""true"", ""userId"": ""838""}"

Set tData(1) = tStringJSON

Set tSC = ..Adapter.SendFormDataArray(.tHttpResponse,"POST",tHttpRequest,,.tData)

Set tText = tHttpResponse.Data.Read()

where does Answer in Ensemble: come from ??

pls add:
write tHttpResponse.Data.Size,!


tHttpResponse.Data.Read return 

ÔºQZéýNÕ V{C?óò?b¢?éÍ )$ 
²5Å?wEë? ??©tÖã1z×2FëÊnôeË æ??]Zßq ܺ?á

you didn't get me. The browsers make something unreadable and useless out of it.

That's just rubbish


ÔºQZéýNÕ V{C?óò?b¢?éÍ )$ 
²5Å?wEë? ??©tÖã1z×2FëÊnôeË æ??]Zßq ܺ?á

pls do:

SET tText tHttpResponse.Data.Read()
WRITE tHttpResponse.Data.Size

So we see the real HEX_content , eventual control characters, ...  and the received number of characters
Similar to your request the response is encrypted. Eventually,  it can be decoded. 

Size: 149

Set tJSON = "{""t"":""x"", ""page"": ""1"", ""onlyActives"": ""true"", ""userId"": ""838""}"
Set httprequest=##class(%Net.HttpRequest).%New()
Set httprequest.ContentType = "application/json" 
Do httprequest.SetHeader("ContentType","application/json")
set httprequest.SSLConfiguration="SSL"
set httprequest.Https=1
set httprequest.Server="server.com"
set httprequest.Port=443
set tSC = httprequest.EntityBody.Write(tJSON)
set tSc = httprequest.Post("/api/api/api/list",)
SET tText = httprequest.HttpResponse.Data.Read()
WRITE httprequest.HttpResponse.Data.Size

you got a reply of 149 characters!

And what was the result of ZZDUMP tText?

It should look similar to  this:

0000: 3F C1 0A C2 30 20 0A 3F 5F 65 E4 2C 63 D2 0A 9D         ?Á.Â0 .?_eä,cÒ..
0010: 27 3D 0A 2A 5E 3C 59 D9 46 A1 ED 24 ED BC C8 DE         '=.*^<YÙF¡í$í¼ÈÞ
0020: DD 74 20 0A 6F C9 F7 FD 24 3F 7C 0A A4 31 A1 7B         Ýt .oÉ÷ý$?|.¤1¡{
0030: 44 E2 68 E0 B0 DD 3F D6 F9 29 32 F3 73 3F 3F 52         Dâhà°Ý?Öù)2ós??R
0040: 3F B8 BC 3F BA 64 3F 24 2C F1 44 2B BB 3F 3F 0A         ?¸¼?ºd?$,ñD+»??.
0050: 3F 20 0A D4 BA 51 5A E9 FD 4E D5 20 56 7B 43 3F         ? .ÔºQZéýNÕ V{C?
0060: F3 F2 3F 62 A2 3F E9 CD 20 29 24 20 0A B2 35 C5         óò?b¢?éÍ )$ .²5Å
0070: 3F 77 45 EB 3F 20 3F 3F A9 74 D6 E3 31 7A D7 32         ?wEë? ??©tÖã1z×2
0080: 46 EB CA 6E F4 65 CB 20 E6 3F 3F 5D 5A DF 71 20         FëÊnôeË æ??]Zßq
0090: DC BA 3F E1 0A                                          Üº?á.

I filled in the marked characters to get to your received size. The real value could help as there is a bunch of controls that could trigger a newline.

The thing looks somehow encoded / encrypted or just binary.
Do you have information on source system ?   (the url is definitely faked)


Bob, your question doesn't belong in the "Developer Community Feedback" group, since that's for -- well -- feedback about Developer Community. Nor is the "Developer Community" tag appropriate for it, since that also is intended for posts about DC. Please edit your post, moving it to another group, perhaps "Ensemble", and removing the "Developer Community" tag.

UPDATE - it looks like someone (one of my fellow mods?) has moved it to the Ensemble group already. You can still remove the tag, and maybe remember not to post to "Developer Community Feedback" in future unless that's the nature of your post. Thanks!