Web forum is in read-only mode. Login as active registered customer for write access
  Forum Search   New Posts New Posts

URI Path segment

 Post Reply Post Reply
Author
Piffer Claudio View Drop Down
New Member
New Member
Avatar

Joined: 24 Jan 2012
Posts: 13
Post Options Post Options   Quote Piffer Claudio Quote  Post ReplyReply Direct Link To This Post Topic: URI Path segment
    Posted: 11 Nov 2019 at 6:04pm
Hi,

I am developing a REST service with XData for a integration where for the construction of the URI path of services and methods I have to follow some specifications.

For example I need to create a service with this path:

/resources/countries/autorities/{authorityCode}/ids/{countryId}

where 

/resources/countries: is the service

autorities is the method

and {authorityCode} -  {countryId} are the parameters.

For create the service uri path is simple. In my countries services interface i add URIPathSegment attribute:

 [URIPathSegment('resources/countries')]

My problem is for the method. I need to get the following path:

/{authorityCode}/ids/{countryId}

How can I do with XData?
Back to Top
Piffer Claudio View Drop Down
New Member
New Member
Avatar

Joined: 24 Jan 2012
Posts: 13
Post Options Post Options   Quote Piffer Claudio Quote  Post ReplyReply Direct Link To This Post Posted: 11 Nov 2019 at 6:35pm
Another sample is this:

/resources/healthcare/companies/{companyCode}/exams/brances

where

/resources/healthcare: is the service

companies: is the method

{companyCode} is the param and /exams/brances is the resource where in post I send the json data

Thank you very much



Back to Top
Piffer Claudio View Drop Down
New Member
New Member
Avatar

Joined: 24 Jan 2012
Posts: 13
Post Options Post Options   Quote Piffer Claudio Quote  Post ReplyReply Direct Link To This Post Posted: 11 Nov 2019 at 6:40pm
In this services I not use Aurelius but DTO and FireDAC
Back to Top
Piffer Claudio View Drop Down
New Member
New Member
Avatar

Joined: 24 Jan 2012
Posts: 13
Post Options Post Options   Quote Piffer Claudio Quote  Post ReplyReply Direct Link To This Post Posted: 11 Nov 2019 at 6:55pm
I tried to define URIPathSegment in the method:

[URIPathSegment('autorities/{authorityCode}/ids/{countryId}')]

This would work but at the end of the path the parameters they are further added even if they have already been linked.

The resutl is:

autorities/10/ids/20/10/20


Back to Top
Wagner R. Landgraf View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 2547
Post Options Post Options   Quote Wagner R. Landgraf Quote  Post ReplyReply Direct Link To This Post Posted: 11 Nov 2019 at 7:00pm
That's currently not possible to map such URLs directly to specific methods. We're working on such feature and it will be included in a near future version, if not the very next one, then probably the one after it.
For now, the workaround would be creating parameters for the fixed path itself, i.e., you define a parameter like "option: string" and check for it:

if option = 'ids' then
  // correct URL
else
  // raise error 404
Back to Top
Piffer Claudio View Drop Down
New Member
New Member
Avatar

Joined: 24 Jan 2012
Posts: 13
Post Options Post Options   Quote Piffer Claudio Quote  Post ReplyReply Direct Link To This Post Posted: 11 Nov 2019 at 8:47pm
Hi Wagner

many thanks!!!

While waiting for the new version I will use your workaround!

Thank you very much and best Regards
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down