Jump to content

Search the Community

Showing results for tags 'rest'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Delphi Questions and Answers
    • Algorithms, Data Structures and Class Design
    • VCL
    • FMX
    • RTL and Delphi Object Pascal
    • Databases
    • Network, Cloud and Web
    • Windows API
    • Cross-platform
    • Delphi IDE and APIs
    • General Help
    • Delphi Third-Party
  • C++Builder Questions and Answers
    • General Help
  • General Discussions
    • Embarcadero Lounge
    • Tips / Blogs / Tutorials / Videos
    • Job Opportunities / Coder for Hire
    • I made this
  • Software Development
    • Project Planning and -Management
    • Software Testing and Quality Assurance
  • Community
    • Community Management

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Delphi-Version

Found 18 results

  1. I have a small REST Web Services app with only 2 Actions -Action 0: Default Action = True MethodType = mtAny - Action 1: Default Action = False MethodType = mtPOST (also tried mtGET) When running as a stand alone EXE everything works as expected. When running the DLL under IIS the Action 0 always responds correctly to requests but Action 1 always fails with a 404.0. This happens on both my Dev computer (Win 11 & Delphi Enterprise 12.1) and a Win Server 2019 Datacenter. I develop and test using IIS Express. Any / all help will be appreciated. TIA
  2. We've been having a strange issue using the TRESTRequest component with some of our users. When we call the request.execute on those devices, it always raises an exception with the message of "External Exception 0". Weirdly it only seems to happen on Samsung devices, particularly newer models such as the S22 Ultra (but not exclusively that device). It happens for every API call we make, but only affects our app. The user reports that all their other apps can talk to the internet fine, so not sure what this could be. We have a number of newer Samsung test devices but can't reproduce this issue. The error seems to be coming from the OS rather than Delphi, but I can't see any reason for it. We've been exploring device config-specific factors such as firewall apps, disabling data access to the app etc but there doesn't seem to be anything special. Most affected users keep their devices as factory default for these settings. I've extract a logcat from those devices (I don't have physical access to the device though), and it doesn't show any errors, warnings or messages related to network access, security or things I would expect if the OS was the cause. We're running out of ideas, and the users are becoming frustrated as they can't use the cloud features of our app. I'd really appreciate any thoughts, suggestions or even just troubleshooting theories that could help to figure this out. Thanks!
  3. i just create rest service with authoticate entry. the default login form look like this : how can i change the login form as i want and control the form shape? lables, headers, positions
  4. Anyone here with RADServer setup experience? I'd like to find some advice or resources on how to secure the Server besides the SSL certificates and usual Apache/NGinx stuff. It would be more on how to avoid anyone being able to hack into the server and change/get data just by using the URL. Using DataSource parameters is a good way to avoid escaping all URL characters and avoiding SQL injection. Found that: https://blogs.embarcadero.com/tech-tip-how-do-i-secure-rad-server-for-production-deployment/ But besides that? It seems to me, without practicing, that passing everything via the URL is a wide open door to guess what could be other URL keywords, variables, etc... I want to make sure that calls are, in a way, logged in with credentials before accessing anything and get answers from the server. That kind of things. I read David I hands on RadServer document, but it's more focused on how to use it for Rest than actually securing it. Thanks for any help and lights on RadServer deployment.
  5. Hello, I am developing on Delphi 11.1. I would like to read a JSON pair REST response received by TRESTResponse object. The response has the following format: {"OrderNo", "W00001987"}. In my first attempt to get the OrderNo value I used this code: OrderNoRESTResp.RootElement := 'OrderNo'; var S: string := OrderNoRESTResp.Content; Result := OrderNoRESTResp.JSONValue.ToString; But in the result were reported the double quotes aoround the order no. After I try with the following code and I get the right order no without double quotes: Jsv: TJSONValue := OrderNoRESTResp.JSONValue; try var Jso: TJSONObject := Jsv as TJSONObject; for var JPair: TJSONPair in Jso do Result := JPair.JSONValue.Value; Is the above code the correct one and the best way to retrieve a single Json pair returned from the TRESTResponse ? Thank you, Davide
  6. I have created an API in Node.JS serving data and PDFs to my Angular front end - all works perfectly. I've also added the PDF bit onto an existing Delphi App that my company uses. There are 5 difference classes of PDF document. The Delphi app works 100% of the time, for all PDF types when I compile it for Mac OSX, however, when I run the Windows version, I get problems with 2 document types - 3 work perfectly (I can also use Postman to get the PDFs without any errors on all types) I create the PDFs on the fly in the server, and the problem PDFs are created from the same bits of server code as the ones that fail. Error: No mapping for the Unicode character exists in the target multi-byte code page I've tried changing the headers sent from the server, and also varied the request headers: I've tried different Content-Types and specified the charset=utf-8. The simple Delphi code bellow, works for all PDF types on the Mac, but only works for a subset of the document types on Windows. (It's the RESTRequest.Execute bit that fails) RESTClient.BaseURL := 'https://api.mysite.com/pdf/' + url; RESTREquest.Method := rmGet; RESTRequest.Params.AddItem; RESTRequest.Params[0].Kind := pkHTTPHEADER; RESTRequest.Params[0].ContentType := ctTEXT_PLAIN; RESTRequest.Params[0].Options := [ poDoNotEncode ]; RESTRequest.Params[0].name := 'authorization'; RESTRequest.Params[0].value := 'Bearer ' + Token; RESTRequest.Execute; if RESTResponse.StatusCode = 200 then begin RespBytes := RESTResponse.RawBytes;
  7. toufik

    TListView Paging

    good morning every one ^^... TListView Paging**** is this look logic to you ? a mobile app + rest . I want to be able to get 10 record every time . so how about putting the last record i get every time and send it back to the server side to get 10 more record starting with it ,,,,and so on ... is this look ok to you thank you
  8. hi every one can some one help me with problem I'm using Delphi REST with server and client but when i tried to show data on the client side its show only one row for some reason, what did i do wrong ? PS : I'm using Delphi roi and restdataware the video down show what I'm deal with ; any help will be very appreciated ^^ thank you on the client side i'm using this code procedure listv; var jsonObj : TJsonObject; json, sucesso, erro,id_store ,nom_store, phone_saler: string; begin // FrmLogin.FloatAnimation2.Stop; // FrmLogin.FloatAnimation3.Stop; if FrmLogin.listvreq.Response.JSONValue = nil then begin // FrmLogin.ExibirCampos; ShowMessage('خطأ في إنشاء الحساب (JSON غير صالح)'); exit; end; try json := FrmLogin.listvreq.Response.JSONValue.ToString; jsonObj := TJSONObject.ParseJSONValue(TEncoding.UTF8.GetBytes(json), 0) as TJSONObject; sucesso := jsonObj.GetValue('sucesso').Value; erro := jsonObj.GetValue('erro').Value; id_store := jsonObj.GetValue('id_store').Value; nom_store := jsonObj.GetValue('nom_store').Value; if sucesso <> 'S' then begin // FrmLogin.ExibirCampos; ShowMessage(erro); exit; end else // showmessage('تم احضار بيانات: ' + id_store+nom_store); // FrmLogin.ExibirCampos;/// // FrmLogin.ListView1.Items.Clear(); finally jsonObj.DisposeOf; end; end; procedure listverr(Sender: TObject); begin if Assigned(Sender) and (Sender is Exception) then begin // FrmLogin.ExibirCampos; showmessage(Exception(Sender).Message); end; end; procedure TFrmLogin.StartLogin2; begin TThread.CreateAnonymousThread( procedure var Success: Boolean; begin try RequestLogin.Execute; Success := RequestLogin.Response.Status.Success; except Success := False; end; TThread.Queue(nil, procedure begin AfterLogin2(Success); end ); end ).Start; end; procedure TFrmLogin.AfterLogin2(Success: Boolean); begin if Success then begin listvreq.Params.Clear; listvreq.AddParameter('type_store',ComboBox1.Selected.Text); /// **** listvreq.ExecuteAsync(listv, true, true, listverr); end else begin showmessage (' عفوا ...! لايمكن الاتصال بالخادم حاليا يرجى المحاولة لاحقا') end; on server side : procedure Tdm.DWEventsEventslistvReplyEvent(var Params: TDWParams; var Result: string); var type_store, erro : string; usuario : TUsuario; json : TJsonObject; begin try sleep(4000); type_store := Params.ItemsString['type_store'].AsString; json := TJsonObject.Create; usuario := TUsuario.Create(dm.conn); usuario.type_store := type_store; if NOT usuario.listv(erro) then begin //{"sucesso": "N", "erro":"Usuلrio nمo informado", "codusuario":"0"} json.AddPair('sucesso', 'N'); json.AddPair('erro', erro); json.AddPair('id_store', ''); json.AddPair('nom_store', ''); end else begin json.AddPair('sucesso', 'S'); json.AddPair('erro', ''); json.AddPair('id_store', usuario.id_store.ToString); json.AddPair('nom_store', usuario.nom_store); end; Result := json.ToString; finally json.DisposeOf; usuario.DisposeOf; end; and in class i add called unit usuario function TUsuario.listv(out erro: string): Boolean; var qry : TFDQuery; begin try qry := TFDQuery.Create(nil); qry.Connection := FConn; with qry do begin Active := false; SQL.Clear; SQL.Add('SELECT * from saler WHERE type_store = :any '); ParamByName('any').Value := type_store; Active := true; if RecordCount > 0 then begin id_store := FieldByName('id_store').AsInteger; nom_store := FieldByName('nom_store').AsString; erro := ''; Result := true; end else begin // id_store := 0; erro := 'تعذر جلب بيانات المعلنين'; Result := false; end; DisposeOf; end; except on ex:exception do begin erro := 'خطأ في التحقق من صحة تسجيل الدخول: ' + ex.Message; Result := false; end; end; bandicam_2021-05-01_17-50-29-913.mp4
  9. Since upgrading to Big Sur, if an attempt to connect to the REST service fails, the App quits unexpectedly. For example, this happens if the user does not have WiFi open and tries to connect, or if the user cannot access the server (i.e. if the server is temporarily unavailable). On previous versions of MacOS, the exception was handled correctly inside the App. Is there something I need to add to plist or something? Or has anything network related been phased out? (The App is developed using Delphi 10.3.3 Community Edition with TRestRequest and executeasync; on Catalina and earlier the ACompletionHandlerWithError is called and the exception handled there). I believe the error being thrown is Runtime Error 231. (I am very new to Apple Development, so apologies if I have missed an obvious place to search for information on this!) There are no issues on Android, iOS or Windows or previous MacOS; only Big Sur.
  10. Hi I am using the Delphi Rest Client and OAuth libraries from the units REST.Utils, REST.Types, REST.Client, REST.Authenticator.OAuth, REST.Authenticator.OAuth.WebForm.Win I have two dll's that uses these units successfully and both have runtime packages turned on for xmlrtl;vcl;vclx;rtl However when I try to load both dll's in the same exe, I get the following exception. exception class : EFilerError exception message : A class named TOAuth1SignatureMethod_PLAINTEXT already exists. Because the rest code seems to be in the rtl package, and both dll's are loading rtl package at runtime, I thought it should be ok, but apparently not. This class TOAuth1SignatureMethod_PLAINTEX is in REST.Authenticator.OAuth unit in C:\Program Files (x86)\Embarcadero\Studio\19.0\source\data\rest At the bottom of this file is the cause initialization RegisterClasses([TOAuth1SignatureMethod_PLAINTEXT, TOAuth1SignatureMethod_HMAC_SHA1]); Does anyone have any ideas how to resolve this ? Regards Peter Bug report below running in 64 bit. Username : peter date/time : 2020-11-20, 10:59:23, 388ms computer name : PETER user name : peter registered owner : peter operating system : Windows 10 x64 build 19041 system language : English system up time : 3 days 21 hours program up time : 2 minutes 47 seconds processors : 12x Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz physical memory : 4135/16235 MB (free/total) free disk space : (C:) 242.90 GB display mode : 2560x1440, 32 bit process id : $5f54 allocated memory : 1.60 GB largest free block : 130989.73 GB executable : prog.exe exec. date/time : 2020-11-20 09:15 version : 10.4.0.0 compiled with : Delphi 10.2 Tokyo madExcept version : 5.0.99 callstack crc : $398bae85, $14cecb7b, $317ff7bb exception number : 1 exception class : EFilerError exception message : A class named TOAuth1SignatureMethod_PLAINTEXT already exists. main thread ($6668): 033dcc0c +0cc rtl250.bpl 033de3fd +02d rtl250.bpl System Classes.RegisterClass 033de48e +01e rtl250.bpl System Classes.RegisterClasses 0328a309 +139 rtl250.bpl System _StartLib 7ffd4d02 +0df ntdll.dll LdrLoadDll 7ffd4ab8 +15b KERNELBASE.dll LoadLibraryExW 08502849 +049 MACM.dll unModuleInterface 164 +4 TModuleInterface.OpenLibrary 0880de40 +010 MACM.dll unRestInterface 213 +1 TRESTInt.OpenLibrary 08502673 +0a3 MACM.dll unModuleInterface 106 +9 TModuleInterface.Create 0880dd4b +08b MACM.dll unRestInterface 204 +1 TRESTInt.Create
  11. The following code snippet throws an exception when assigning the EMSProvider to the BackendEndpoint: EBackendServiceError with message 'Service not supported by EMS provider' EMSProvider1 := TEMSProvider.Create(self); EMSProvider1.Name := 'EMSProvider1'; bePOSTException := TBackendEndpoint.Create(self); bePOSTException.Name := 'bePOSTException'; bePOSTException.Provider := EMSProvider1; What service does the error refer?
  12. Hi all Delphier , good morning 😀😀 i have rest firemonkey app ,server , client im trying to check if the server is up or down from the client side using the code below , the code work fine , but when i run it its freeze the app for a while is there any proper way to do this ,thank you ,🤓☺️ try RequestLogin.Execute; if FrmLogin.RequestLogin.Response.Status.Success then begin showmessage ('server up') do something ..... end else except on e : exception do begin showmessage (' server down.... go home ') end end;
  13. How to send files to an API using TSslHttpRest? In Postman I can, this is the http code: POST /api/br-invoice-integration/v1/batches HTTP/1.1 Host: qed.onvio.com.br Accept: application/json Authorization: Bearer 42dc0b99-2d17-4898-9c85-0b52ae364c63Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW ----WebKitFormBoundary7MA4YWxkTrZu0gW Content-Disposition: form-data; name="file[]"; filename="/C:/MyFile.xml" Content-Type: text/xml (data) ----WebKitFormBoundary7MA4YWxkTrZu0gW Content-Disposition: form-data; name="query" {"boxe/File":true} ----WebKitFormBoundary7MA4YWxkTrZu0gW With SslHttpRest, I'm trying to SendStream, like that (similar to the sample OverbyteIcsHttpPost1): FileName := 'C:\MyFile.xml'; RandBoundary := '-----------------------------' + IntToHex(Random(MaxInt), 8) + IntToHex(Random(MaxInt), 8); SslHttpRest1.ContentTypePost := 'multipart/form-data; boundary=' + RandBoundary; Header := RandBoundary + #13#10 + 'Content-Disposition: form-data; name="file[]"; filename="' + 'MyFile.xml' + '"' + #13#10 + 'Content-Type: text/xml' + #13#10 + #13#10; Footer := RandBoundary + #13#10 + 'Content-Disposition: form-data; name="query"' + #13#10 + #13#10 + '{"boxe/File":true}' + #13#10 + RandBoundary + #13#10; SslHttpRest1.SendStream := TMultiPartFileReader.Create(Filename, Header, Footer); SslHttpRest1.SendStream.Position := 0; SslHttpRest1.RestRequest(httpPOST, Myurl); But it doesn't work, just get error: Request completed: 500 Request done, StatusCode #500 {"error":{"code":500,"errors":[],"message":"HTTP 400 Bad Request"}} Has anyone ever needed to do something similar, would this be the way? If anyone can help, I appreciate it.
  14. Hello, I have orders and orderdetails tables. There is one method that should be returning several orders when used. I would like to return a json string to such requests as in following example { "orders":[ { "id":1234, "date":"2020-05-29", "details":[ { "item":"1", "amount":3 }, { "item":"5", "amount":2 }, { "item":"116", "amount":1.3 } ] } ] } I know that I can define method to return a TJsonObject and build json piece by piece in method code. However, I would like to avoid that, if possible. I wonder if there is/are some other ways of doing so in MARS. Thanks & regards, Ertan
  15. Wij zijn op zoek naar een nieuwe aanwinst voor ons ontwikkel team in Oosterwolde. Syntri ontwikkelt een ERP systeem voor de maakindustrie, waarbij proces en workflow centraal staan. - Delphi 10.3 Rio VCL - iOS en Android ontwikkeling in Firemonkey - REST Api Vacature Software Ontwikkelaar
  16. Frédéric

    TDSRestConnection, bug in DoSetCredential

    Hi, Just want to share this and to eventually have confirmation (or not !!) I suspect a bug in the DoSetCredential method used by TDSRestConnection (System.Net.HttpClient.Win, TWinHTTPClient.DoSetCredential) I'm just upgrading an (working !) application from Delphi XE7 to Delphi 10.3.1. It's an application using Datasnap REST to communicate with a standalone Datasnap server (or IIS ISAPI in production) By doing my first tests I immediatly encountered the following problem: By calling the TDSRestConnection.TestConnection I get this error: Error adding header (87): Incorrect parameter ==> ('Paramètre incorrect' translated from french) Basic authentication is used. After debugging the code I saw that TNetEncoding.Base64.Encode adds a linebreak after 76 chars (The base64 encoded credentials goes slightly over 80chars...). This seems the default behavior the TBase64Encoding class but the WinHttpAddRequestHeaders API don't like it. I have changed the code in System.Net.HttpClient.Win to change the CharsPerLine to 255 and then it is OK. Bug or misuse ? Thanks ! Frederic
  17. Davide Visconti

    Web dashboard application

    Hi, I state that I have no skills on the argument, so bear with me. I have read a lot since last week but the argument is really a jungle and I'd like to read your very useful suggestions. I try to explain what we have to do. At the moment we have a win32 application developed in VCL Delphi Tokyo. This app read/write on localhost Firebird DB. Now, we have to realize a web application, like a dashboard , wich the users can utilize to see some values, some charts, execute some predefined queries and change some parameters on DB, the VCL app get some notifications when this happened (event alert) to update the in memory parameters. This web app should run on computer and android mobile too, like this forum 🙂 The number of clients connected are very few, maximum 5. Now, according to you, what library, framework, we have to use for the front-end...? For the back end? I have to use a REST service like @Andrea Magni's MARS Curiosity? Finally, can you give me some guide or how-to that you've found useful to begin please? THANKS A LOT for any suggestions.
  18. It is just a small addition to MARS Client library capabilities but TMARSClientResourceJSON now implements REST.Client.IRESTResponseJSON interface (from Delphi's REST Client library). This basically means you can use a TMARSClientResourceJSON and materialize a dataset through the TRESTResponseDataSetAdapter component (from Delphi's REST Client library). Enjoy 😉
×