Jump to content

Search the Community

Showing results for tags 'trestrequest'.



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 2 results

  1. 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
  2. Bob Baudewyns

    REST: Delete an object

    Looking for some help from Delphi community as I'm blocked with my project. I am working with SynchroTeam API using their REST API. SynchroTeam API I can successfully GET and POST data without any problem. But I can't find out the right way to delete a job.. Delete a job After downloading all jobs Object, I'm trying to delete some of them. So, I know ID, MyID and NUM properties of each Job. However, when I'm using the following code: RESTClient:= TRESTClient.Create('https://ws.synchroteam.com/api/v3'); with RESTClient do begin Accept:= 'application/json'; AcceptCharset:= 'UTF-8'; Authenticator:= HTTPBasicAuthenticator; SecureProtocols := [THTTPSecureProtocol.TLS12]; end; RESTRequest.Method:= TRESTRequestMethod.rmDELETE; RESTRequest.Resource:= 'job/delete'; RESTRequest.AddParameter('Content-Type', 'application/json', TRESTRequestParameterKind.pkHTTPHEADER, [poDoNotEncode]); RESTRequest.AddParameter('Accept', 'text/json', TRESTRequestParameterKind.pkHTTPHEADER, [poDoNotEncode]); RESTRequest.AddParameter('myId', '467925', TRESTRequestParameterKind.pkQUERY, [poDoNotEncode]); RESTRequest.Execute; I get the error 404: Job does not exists. I'm 100% sur about myId. I also tried with ID property: same result. I also tried with all relevant TRESTRequestParameterKind for myId parameter. I always get 404 What would be the correct way to delete a record using Delphi REST.Client.TRESTRequest ? Thank you for your help
×