58
Views
7
Comments
REST caller
Question

I created a REST service, is it possible inside one method see who did the call (url or something)

2025-10-09 15-40-22
Craig St Jean
Staff

Hey Filipe,

By "inside one method" do you mean inside the REST service method?  And by "who did the call", you can always add input parameters to the method if you need additional context.  A web request will always have a remote IP, but you would only be able to get the referring URL header if one was passed to it by a browser, which will not help if the service is called by any other method.

2024-01-05 16-00-17
Filipe Lourenço

Craig St.Jean wrote:

Hey Filipe,

By "inside one method" do you mean inside the REST service method?  And by "who did the call", you can always add input parameters to the method if you need additional context.  A web request will always have a remote IP, but you would only be able to get the referring URL header if one was passed to it by a browser, which will not help if the service is called by any other method.

By "inside one method" do you mean inside the REST service method? Yes

And by "who did the call", you can always add input parameters to the method if you need additional context

Yes but i dont want to add extra dummy parameters just to get that.

In this case is by one internal application so i have always a requester even if the call is made by javascript


2025-10-09 15-40-22
Craig St Jean
Staff

Is the JavaScript call a part of the same application?  If not, I would suggest adding a username header or something that you can then retrieve in the REST service.  Or, if you want the referrer URL you can use GetRequestHeader from HTTPRequestHandler and pull the value of the referer header (yes it is misspelled, but that is how the web standard has it).

Or am I misunderstanding?

2024-01-05 16-00-17
Filipe Lourenço

Craig St.Jean wrote:

Is the JavaScript call a part of the same application?  If not, I would suggest adding a username header or something that you can then retrieve in the REST service.  Or, if you want the referrer URL you can use GetRequestHeader from HTTPRequestHandler and pull the value of the referer header (yes it is misspelled, but that is how the web standard has it).

Or am I misunderstanding?

Is the JavaScript call a part of the same application? Yes


2025-10-09 15-40-22
Craig St Jean
Staff

And are you looking for the URL the user was on, or the logged in user id?

2024-01-05 16-00-17
Filipe Lourenço

the URL the user was on or espace

2025-10-09 15-40-22
Craig St Jean
Staff

Just trying to understand, is this more or less what you are trying to accomplish?  I have a button with JavaScript that calls a REST URL that reads the HTTP header referer and returns it.

AjaxREST.oml
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.