#1 2018-02-02 09:10:43

CycleSoft
Member
Registered: 2013-01-18
Posts: 34

Invoke interface based method with GET/PUT/DELETE

Hi all,
as far as I understand, invoking an interface method from a delphi client translate in a

POST /interface/method

call. Is there a way to force the client to make the same call with different HTTP verbs ?

Offline

#2 2018-02-02 09:57:41

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,272
Website

Re: Invoke interface based method with GET/PUT/DELETE

As documented, you can also use GET + parameters encoded on the URI.
https://synopse.info/files/html/Synopse … #TITLE_449
RTFM!

If you want something more complex, create your own routing class.

Offline

#3 2018-02-02 12:03:33

CycleSoft
Member
Registered: 2013-01-18
Posts: 34

Re: Invoke interface based method with GET/PUT/DELETE

Hi Ab,

I've re-read TFM smile
as I remembered it says that: The pure Delphi client implementation will use only POST.

Your first suggestion to use URL encoded params with a GET verb does not meet my needs because does not cover PUT and DELETE verbs.

Just to explain better my question, my problem is NOT about how to encode params, but only about the HTTP verb to use, ie how to make a

DELETE /interface/method or

PUT /interface/method

call from Delphi, with the params in the body as for the 'standard' call that delphi do, a POST

If nothing easy/ready is already implemented, please just only point me in the right direction, any suggestion from the Guru will be welcome! :-)

Thanks for your support!

Offline

#4 2018-02-02 13:25:46

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,272
Website

Re: Invoke interface based method with GET/PUT/DELETE

Why on earth would you do that?

Offline

#5 2018-02-02 13:46:43

CycleSoft
Member
Registered: 2013-01-18
Posts: 34

Re: Invoke interface based method with GET/PUT/DELETE

Cause I consume some interface based services from an AJAX client, trying to follow a REST approach, so for example I have a service

/customers/order

I can call with GET/PUT/POST/DELETE to perform CRUD operations.

I'd like to consume the same methods from a Delphi client, w/o changes on server side.

If I am not wrong with method based services this is a no-issue, but I LOVE the design that interface based methods enforces on the server!

Sounds strange to me nobody else has similar needs. Am I missing something ?

Offline

#6 2018-02-02 14:54:11

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,272
Website

Re: Invoke interface based method with GET/PUT/DELETE

Interface-based services are providing RPC-like services over REST, not true REST services.
So changing the verb don't make much sense, since on the server side, there is no way of using it.

If you expect something diverse than the default routing scheme, you will have to define your own routing class.
But it will be a lot of work for IMHO no advantage, since it will be hidden behind the hood.

Offline

Board footer

Powered by FluxBB