[SalesForce] Populating Client ID for API Call reporting purposes

This is loosely in reference to another Question: Client Id blank in "API Calls Made Within Last 7 Days"-Report

I'd like to find out, so that our Developers can implement it, where specific information is that would guide them on setting a Client ID on API calls (mostly from PHP, ASP, etc) to help isolate where calls are coming from on our site(s).

A very simple report is attached. There are rows further down this report that have 100's of thousands of calls, and most of them are BLANK client ID due to them being from our site(s).

enter image description here

Now that I'm out of developer wanna-be mode, I have searched a bit, but cannot find any pages via Google that help with this specifically. :-/ The closest I've found is along the lines of this: https://developer.salesforce.com/forums?id=906F00000008tP2IAI

Thanks for any guidance. 😉


Update: I just realized I did post about this a long time ago, but feel like this question is better equipped to relay the desired effect.

API Calls – What Script/ Page/ Etc Made The Call?

Best Answer

@AMM, it looks like all you need to do is set the client element within the CallOptions header when making API calls. Take a look at the screenshot below showing a report that lists the custom Client ID sent with an API call.

enter image description here

Below is the snippet of Ruby code I used to produce that audit record.

login_header = { "tns:CallOptions" => { "tns:client" => "retrieve-profiles-and-permissionsets.rb" } }
login_message = { username: username, password: password + token }
soap_response = partner_client.call :login, soap_header: login_header, message: login_message
Related Topic