[NEW UPDATE] I’ve replaced this component with a re-write named “deREST” – find out more here: http://chapmanworld.com/2018/07/21/instantly-expose-a-table-as-a-rest-endpoint-again/
Since my skill sprint on JSON/REST services in Delphi and C++ builder back in February, one thing has been nagging on my mind. The code that I wrote for that skill sprint was written specifically to expose one particular database table, but it was almost generic enough that it could expose any database table. So why don’t I write a component for exposing tables as JSON/REST endpoints?
Well, for the past two or three days I’ve been working on just such a component, and I’d now like to demonstrate for you, just how easy it can be to create a JSON/REST service application using it. The server side component, when placed into a WebBroker application module, automatically adds an endpoint, and you simply need to bind the component up to a database connection to make it function.
[Video Removed] – I’ll leave the download here for anyone still using it, but I’ve replaced this component: http://chapmanworld.com/2018/07/21/instantly-expose-a-table-as-a-rest-endpoint-again/
DISCLAIMER
I must apologize for needing a disclaimer, but I’m sure you’ll understand why it’s necessary…
Before I hand you the source code for this component, and demonstrate it’s use, I’d like to make one thing very clear. I wrote this component (actually two components) for no other purpose than to demonstrate that it could be done. I wouldn’t want you to think that this code is in any way safe for commercial use. I do provide these components free of charge, and welcome you to use them for any purpose, however, as it is not commercial grade code I will not be held responsible if you use it and incur damages. I would be happy to entertain volunteers that wish to review and enhance the code, add unit tests, add injection protection, authentication and so on, however, I will not personally be investing in this code any further. Okay?
The source:
Okay, so the source code is may be downloaded here: JCRUD
Thanks for reading!







I done little bit changes, but when I got $.ajax command got in my web client ( html pages with jquery ) server response was with error : Failed to load http://192.168.0.138:8787/….: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘null’ is therefore not allowed access. The response had HTTP status code 400.
What have do I do ? help me..
for mssql server work very well.When I write url to web client rersponse JSON is ok.
thank you
Sorry for the late reply. I’ve been on vacation.
Are you hosting your client application from the same server/service?
It’s my understanding that browsers don’t allow ‘cross-origin’ requests, where-by the request is on a server other than the one which served up the javascript that they’re running.
Please see my replacement component here: http://chapmanworld.com/2018/07/21/instantly-expose-a-table-as-a-rest-endpoint-again/
++ Please watch this space – I am planning to make available a more robust replacement for this component in the next few days, perhaps so long as a week.
Please see my replacement component here: http://chapmanworld.com/2018/07/21/instantly-expose-a-table-as-a-rest-endpoint-again/
Please see my replacement component here: http://chapmanworld.com/2018/07/21/instantly-expose-a-table-as-a-rest-endpoint-again/
Hi,
I’m trying to create small application using 1 table as your short tutorial, server running tested with browser 3 record show up, but when I try to connect the client always get error “no peer with the interface with guid {xxxx}”.
Is there any hints for this error?
Thanks,
Tegoeh
I really have no idea where this error is coming from, and suspect it’s somewhere between FireDAC and the Database. I’m curious which database engine you’re using?
In any case, there is a possibility that you’ve run into a situation in which the ICRUD interface requires a GUID, so you could try this…
Open jcrud.crud.pas and scroll down to line 103. Press [CRTL]+[SHIFT] [G], which should inject a GUID into the code. The do a clean and build and test again.
Hi,
I’m using Firedac Connection with Postgresql as database, I already done inject the GUID clean and build the code but error still show up.
Error said “Module Load: IPHLPAPI.DLL. No Debug Info. Base Address: $72CD0000. Process LokClient.exe (8608)
First chance exception at $7523A832. Exception class EIPAbstractError with message ‘No peer with the interface with guid {E0125434-B354-482C-BD99-7E61623721FF} has been registered’. Process LokClient.exe (8608)”
Any comment is appreciated.
Thanks,
Tegoeh
Please see my replacement component here: http://chapmanworld.com/2018/07/21/instantly-expose-a-table-as-a-rest-endpoint-again/
Please see my replacement component here: http://chapmanworld.com/2018/07/21/instantly-expose-a-table-as-a-rest-endpoint-again/
really good component.
I have a qustion about , how can i make a login form useing this component ?
i create another table in DB and called it ‘Login’ and JCRUDRESTFireDACServer (Endpoint (login) and key field (ID)) >> working good at webbrowser
in Client
i add another TJCRUDRestClientDataset (Endpoint (login))
I insert this code
if Login.Active then begin
Login.Insert;
Login.FieldByName[‘ID’] :=Edit1.Text;
Login.FieldByName[‘User’] :=Edit2.Text;
showmessage (‘Done’);
Login.Post;
end;
And I show this message :
—————————
Error
—————————
HTTP/1.1 500 Internal Server Error.
—————————
OK
—————————
If this is working in your web browser, but not in the application, the most likely cause is an incorrect field in the client.
Many database fields are case sensitive, so please check the case of your fields within FieldByName[] so that they match the case of the same fields in the database.
Please see my replacement component here: http://chapmanworld.com/2018/07/21/instantly-expose-a-table-as-a-rest-endpoint-again/
Please see my replacement component here: http://chapmanworld.com/2018/07/21/instantly-expose-a-table-as-a-rest-endpoint-again/