![]() |
AW: TMS Webcore app mit DB auf gehosteten Systemen
Hi TigerLilly,
super, tolle hilfe, funktioniert bei mir aber leider nicht: alles noch lokal im Browser: ![]() ergibt {"records":[{"id":1,"company":"Company A","last_name":"Bedecs","first_name":"Anna","email _address":null,"job_title":"Owner","business_phone ":"(123)555-0100","home_phone":null,"mobile_phone":null,"fax_n umber":"(123)555-0101","address":"123 1st Street","city":"Seattle","state_province":"WA","zi p_postal_code":"99999","country_region":"USA","web _page":null,"notes":null,"attachments":""},{"id":2 ,"company":"Company B","last_name":"Gratacos Solsona","first_name":"Antonio","email_address":nu ll,"job_title":"Owner","business_phone":"(123)555-0100","home_phone":null,"mobile_phone":null,"fax_n umber":"(123)555-0101","address":"123 2nd Street","city":"Boston","state_province":"MA","zip _postal_code":"99999","country_region":"USA","web_ page":null,"notes":null,"attachments":""},{"id":3, "company":"Company C"..... Das Ganze mit Rest Explorer 1.2 auf ![]() dann in Delphi:
Delphi-Quellcode:
liefert mir
object Form1: TForm1
Width = 1096 Height = 681 Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] FormContainer = 'appcontent' ParentFont = False OnCreate = WebFormCreate object WebLabel1: TWebLabel Left = 24 Top = 40 Width = 180 Height = 16 Caption = 'Click on column headers to sort' ElementID = 'description' Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -13 Font.Name = 'Tahoma' Font.Style = [] HeightPercent = 100.000000000000000000 ParentFont = False WidthPercent = 100.000000000000000000 end object WebLabel2: TWebLabel Left = 24 Top = 8 Width = 62 Height = 13 Caption = 'DBGrid Demo' ElementID = 'title' HeightPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000 end object WebDBGrid1: TWebDBGrid Left = 24 Top = 59 Width = 1049 Height = 470 Columns = < item DataField = 'Company' Title = 'Company' end> DefaultRowHeight = 80 DataSource = WebDataSource1 FixedCols = 0 Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -13 Font.Name = 'Tahoma' Font.Style = [] Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goRowSelect] ParentFont = False TabOrder = 0 HeightPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000 OnFixedCellClick = WebDBGrid1FixedCellClick ColWidths = ( 64) RowHeights = ( 80 80 80 80 80) end object WebClientConnection1: TWebClientConnection Active = True URI = 'localhost/api.php/records/customers/' Left = 464 Top = 544 end object WebDataSource1: TWebDataSource DataSet = WebClientDataSet1 Left = 624 Top = 552 end object WebClientDataSet1: TWebClientDataSet Connection = WebClientConnection1 Params = <> Left = 256 Top = 552 object WebClientDataSet1Brand: TStringField FieldName = 'Company' Size = 256 end end end ERROR Error connecting to URI localhost/api.php/records/customers/ | fMessage::Error connecting to URI localhost/api.php/records/customers/ FJSError::Error: Error connecting to URI localhost/api.php/records/customers/ fHelpContext::0 at ![]() auf ![]() und die gleiche Fehlermeldung bekomme ich auch schon, wenn ich ich mir im Designer auf WebClientDataset die Felder holen will... Bin ich zu doof, oder was ist hier los? |
AW: TMS Webcore app mit DB auf gehosteten Systemen
Zitat:
|
AW: TMS Webcore app mit DB auf gehosteten Systemen
Zitat:
Bis bald... Thomas |
AW: TMS Webcore app mit DB auf gehosteten Systemen
So, jetzt habe ich es: in der WebCLientConnection musste noch der DataNode auf "records" gesetzt werden!
Danke euch allen...jetzt kann es weitergehen |
AW: TMS Webcore app mit DB auf gehosteten Systemen
:- ) Stand aber im Beispiel drin. Gut, dass es jetzt funkt. Viel Spaß!
|
AW: TMS Webcore app mit DB auf gehosteten Systemen
So, und jetzt habe ich es auch endlich auf dem gehosteten System laufen:
für die, die vielleicht ein ähnliches Problem haben: ich musste in der api.php nocht den basePath auf '/api.php' stzen..... Das soll einer ahnen ;-) Aber Danke nochmal an alle für diesen coolen Tip... jetzt werde ich das nochmal mit Berechtigungen testen ... mal schauen, wie lange ich brauche, um das zum Laufen zu bekommen ;-) |
AW: TMS Webcore app mit DB auf gehosteten Systemen
Zumindest mit ApiKey war das ganz unkompliziert:
Code:
Und in der Connection setzt du im Code oder zur Designtime
$config = new Config([
'driver' => 'mysql', 'address' => 'xxx', // 'port' => '3306', 'username' => 'xxx', 'password' => 'xxx', 'database' => 'xxx', ---> 'middlewares'=>'apiKeyAuth', ---> 'apiKeyAuth.keys'=>'abc,def', // da sind mehrere möglich 'debug' => false ]);
Code:
Connection.Headers.Add('X-API-Key=abc');
|
AW: TMS Webcore app mit DB auf gehosteten Systemen
Hallo TigerLilly,
du scheinst ja schon viel Erfahrung mit dem Setup zu haben. Das mit dem Daten holen funktioniert wunderbar, auch mit dem APIKey(Danke dafür nochmal!!!). Jetzt bin ich aber auf das nächste Problem gestoßen: Ich würde nun gerne die Daten die ich über die CRUD -API erhalten habe aus der Webcore Anwendung auch aktualisieren, aber ApplyUpdates,Post oder was auch immer geht gar nicht als request an die CRUD-API raus... Hast du eine Idee, was ich jetzt wieder falsch bzw. vergessen habe mache...oder geht das gar nicht? Gruß |
AW: TMS Webcore app mit DB auf gehosteten Systemen
:-) Freut mich, wenn ich hefen konnte.
In ReadMe zur API steht:
Code:
Das Updaten geht analog zum Lesen, nur mit PUT statt GET.
#### Update
To update a record in this table the request can be written in URL format as: PUT /records/posts/1 Where "1" is the value of the primary key of the record that you want to update. Send as a body: { "title": "Adjusted title!" } This adjusts the title of the post. And the return value is the number of rows that are set: 1 TWebClientConnection hat eine Property Command, mit der du das machen kannst. Ich hab grad keine Zugriff auf meinen Code, ich such das später raus. |
AW: TMS Webcore app mit DB auf gehosteten Systemen
Zitat:
Ja, das mit der CRUD API habe ich gelesen, und wenn ich das über nen Rest Explorer mache funktioniert es auch... Mir ist nur gerade trotz Lesen der TWebClientConnection völlig unklar, was zu machen ist ... Aber ich freue mich schon auf deinen nächsten Code-Snippet.. der ist dann bestimmt wieder so hilfreich wie die Teile zuvor ;-) Gruß |
Alle Zeitangaben in WEZ +1. Es ist jetzt 07:33 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz