i'm developing a rest API with TMS Sparkle and i would like to know the elegant way to read the customer {ID} from this request :
http://localhost/v1/customers/{ID}
I could just do reverse read in the final characters until i find a "/" character, but doesn't seen's the elegant way to me, there's another way to do it ?
This {ID} value is a part of the RequestedPath, but im wondering if there's a property which hold this value ?
I already read the documentation of the Examining the Request doc tutorial, but there's no mention of how read complementary values from the request.
When you inspect the Request
you can access the different parts of it via the URI.Segments
property like this:
procedure TMySparkleModule.ProcessRequest(const C: THttpServerContext);
var
r: THttpServerRequest;
str: string;
begin
r:=C.Request;
for str in r.Uri.Segments do
...
end;