ZRomik
-
Content Count
54 -
Joined
-
Last visited
Posts posted by ZRomik
-
-
After clean and rebuild project on emulator READ_SMS permission work fine. I Try on phone after charging them
-
-
Hi!
I wrote small app for Android for test. In OnCreate method I request Some permission from OS
FStorageRead := JStringToString(TJManifest_permission.JavaClass.READ_EXTERNAL_STORAGE); FStorageWrite := JStringToString(TJManifest_permission.JavaClass.WRITE_EXTERNAL_STORAGE); FReadSms := JStringToString(TJManifest_permission.JavaClass.READ_SMS); PermissionsService.RequestPermissions([FReadSms, FStorageRead, FStorageWrite], nil, DisplayRationale);
So, only requests READ_EXTERNAL_STORAGE and WRITE_EXTERNAL_STORAGE works fine.
Is anybody know why READ_SMS permission not requested? I use for test my Xiaomi Redmi Note 4 with MIUI-10 on Android 6.0.
On Android emulator is the same thing.
-
Is there an ics library for lazarus?
-
Today I got strange assert
QuoteProject wesa.exe raised exception class EAssertionFailed with message 'Memory leak (D:\Projects\Eve Online\Wesa\trunk\ics\OverbyteIcsSuperObject.pas, line 6597)'.
This assert raised before I free the components.
I'm doing rest auth, after close app and got assert.
-
Thank for help. I'm doing sync request in for cycle and sometime got yhis error. Problem solved when i add empty for cycle for 1000 times.
-
Another question about HttpCli. How do I know if a component is ready to work? Sometime I get error
QuoteHTTP component is busy.
-
OK. Thanks
-
Can you tell me more how to do this?
-
Angus, is there possible get response from server not by event, like in Synapse eg
-
all that had to be done was to add this code.
cli1.Accept := 'application/json;';
Now I successfull recieve data from server.
Thanks for help!
-
I tried to build manual the parameters with SuperObject but still got error
-
On 8/19/2019 at 1:49 PM, Angus Robertson said:The OverbyteIcsHttpRestTst.dproj sample has a grid titled REST Parameters where you enter multiple Names and Values, select REST Content as Json, request type POST and enter your URL. If a Json response is returned, it is also displayed as a grid.
The OverbyteIcsSslHttpRest.pas unit itself has several examples of setting RestParams using code, for making OAuth requests, DNS over HTTPS and SMS. and OverbyteIcsSslX509Certs.pas has numerous examples ordering SSL certificates.
Beware the RestParams properties don't easily handle arrays, sometimes it's easier to build the parameters using a Jspn library, ICS includes SuperObject which works with all versions of Delphi, since Json was only added to the Delphi language in more recent versions.
Angus
I tried to do that you say, but got error too.
QuotePOST https://esi.evetech.net/latest/universe/ids/
{"names":[\"water\"]}
Async request started
Connected OK to: esi.evetech.net (34.248.103.232)
> POST /latest/universe/ids/ HTTP/1.1
> Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
> Accept-Encoding: gzip, deflate
> Content-Type: application/json; charset=UTF-8
> User-Agent: Mozilla/4.0
> Host: esi.evetech.net
> Content-Length: 21
> Authorization: Bearer 1|CfDJ8HHFK/DOe6xKoNPHamc0mCWDxGEmxFRUkc+z70lyhp9t80eZRXMbUNkSGeGN6FegDZbhXS50FQd9S661Xqy13guYB4SlTGflVH17Gd9ICEPizz3UILtQZavW70eo4BvXpQujhUaFBkIaEpmB8xuRe//qF/dAZcIjA+5fQzYqmPYP
>
esi.evetech.net SSL Connected OK with TLSv1.2, cipher ECDHE-RSA-AES128-GCM-SHA256, key auth RSA, key exchange ECDH, encryption AESGCM(128), message auth AEAD
< HTTP/1.1 400 Bad Request
< Date: Sat, 24 Aug 2019 19:41:45 GMT
< Content-Type: application/json; charset=UTF-8
< Content-Length: 58
< Connection: keep-alive
< Access-Control-Allow-Credentials: true
< Access-Control-Allow-Headers: Content-Type,Authorization,If-None-Match,X-User-Agent
< Access-Control-Allow-Methods: POST,OPTIONS
< Access-Control-Allow-Origin: *
< Access-Control-Expose-Headers: Content-Type,Warning,ETag,X-Pages,X-ESI-Error-Limit-Remain,X-ESI-Error-Limit-Reset
< Access-Control-Max-Age: 600
< Allow: OPTIONS,POST
< Strict-Transport-Security: max-age=31536000
< Vary: Accept-Language
< X-Esi-Error-Limit-Remain: 99
< X-Esi-Error-Limit-Reset: 15
< X-Esi-Request-Id: b794dc84-eebf-42dc-8a4c-58aaacde3b2c
Request completed: 400 Bad Request
Request done, StatusCode #400
{"error":"too few items for 'names', 'names' is required"}
Json main content type: stObject
This is the example from server
Quotecurl -X POST "https://esi.evetech.net/latest/universe/ids/?datasource=tranquility&language=en-us" -H "accept: application/json" -H "Accept-Language: en-us" -H "Content-Type: application/json" -d "[ \"water\"]"
I tried to use both address string: "POST https://esi.evetech.net/latest/universe/ids/?datasource=tranquility&language=en-us" and "POST https://esi.evetech.net/latest/universe/ids/" with same result
-
Angus, I'm really can't find where specifyed Json parameters in example you told
-
1 hour ago, FPiette said:Sorry, I have no idea. It looks like you feed bad parameters to the component. I suggest you restart from beginning, starting with the samples provided which are working. Then modify the sample step by step until it either works for you or fail. If it fails, use the debugger to try understand what is wrong.
In examples I can't find sample with post request.
-
About error Bad request: The exception class is EHttpException. This class described in unit OverbyteIcsHttpProt.pas. Its's not response from server, but internal component error as I understad.
QuoteJan 23, 2012 V7.23 Arno added httperrNoStatusCode, passed to OnRequestDone and
raised in sync mode if connection closed prematurely. Always raise
EHttpException with the internal httperror code rather than the
HTTP status code if FRequestDoneError is set, this changed
EHttpException's ErrorCode property value of abort and timeout
exceptions.
-
I set breakpoint at line cli1.Post and look inside component code:
In method AdjustDocName field FDocName changed from '/latest/universe/ids/' to 'document.htm'
When we enter in method "TCustomWSocket.DnsLookup" the field "FDnsLookupHandle" is equal 0 and code after line 9438( unit OverbyteIcsWSocket.pas) not executing.
So, we not execute DnsLookup and DnsList is clear. As I understud we not establish connection with server and not sent any data -
Looks like program not send any data to host -
I'm download and run Wireshark. Set filter as "ip.dst == 52.51.209.180"(ping to esi.evetech.net gave me that address). But wireshark does't seen any packet to host, exclude ping
-
OK. I'll try to find another app. Tnanks for advise.
-
I add code
FSndStrm.Seek(0, soFromBeginning);
But this not helps. I recieve from server "{"error":"too few items for 'names', 'names' is required"}"
-
Again trying send post-request as follow:
if Not Assigned(FRcvStr) then FRcvStr := TMemoryStream.Create; if not Assigned(FSndStr) then FSndStr := TMemoryStream.Create; s := '{"names": ["Water"]}'; FSndStr.Write(s[1], Length(s)); cli1.SendStream := FSndStr; cli1.RcvdStream := FRcvStr; cli1.PostASync;
So, If I use method Post then I get eror "BadRequest". If I use method PostAsync then I got answer; "{"error":"too few items for 'names', 'names' is required"}". Looks like data not sending to server.
-
Hello Again!
OK, I need to get some data from server accross post-request. I write small app but always get error "Bad request". Can you see my code please?
I use property ContentTypePost for set content-type as "application/json"
-
Is there a way to know that the TRestOAuth component has updated the authorization token if autoupdate is set?
READ_SMS permission not requested
in FMX
Posted
Yes! On phone work too Thanks for help Lars Fosdal