3

We have the following REST endpoint

@RestResource(urlMapping='/multi/v1/Contact/ContactId__c/*')
global with sharing class ContactMultiV1 {
  @HttpPost
  global static MultiV1.SuccessResponse[] post(Contact[] records){
    return MultiV1.getSuccessResponse(Database.upsert(records, Contact.Fields.ContactId__c, false));
  }
}

This is a legacy code that was not docummented and we would like to know if the endpoint is still being called and by whom. Do you know how to get the host/ip of the called ? Does salesforce have something that we can check the last calls made?

Thanks

10

Regardless as to whether the REST API is exposed behind authentication or not, you have access to the RestRequest within your Apex code. You can use the RestRequest.remoteAddress to discover where the invocation originated.

In addition, if you use an authenticated REST API, rather than one based on guest user access, you can access detail of the User via the UserInfo which may help understand who is using the service, not just from where.

4

If you happen to have licensed Event Monitoring, you can see details of the source of each request to a given URI

There are many Event Log types logged. One of them is the Apex REST Event API Type. Among other fields, you have access to:

  • Client IP
  • UserId
  • Timestamp

EventLogs can be retrieved using Workbench, various Salesforce plugins for enterprise-grade logging tools like SumoLogic, and, the free Event Monitoring Salesforce app that comes along with the Event Log Monitoring license.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.