function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SEKAR RAJ.SEKAR RAJ. 

How can i query remote site settings records using apex class?

I have to query and update a remote site setting after sandbox refresh. Is anyone know how to query remote site settings records?
Best Answer chosen by SEKAR RAJ.
Yogeshwar TailorYogeshwar Tailor
Hi Sekar,

Use tooling api...

/services/data/v45.0/tooling/query/?q=select+id,EndpointUrl,isActive+from+RemoteProxy

Eg : https://salesforce.stackexchange.com/questions/15843/tooling-api-usage-in-salesforce-apex-method

replace the url in that example.

from workbench you can test it.
User-added image

let me know if you face any issue.

Thanks,
Yogesh

All Answers

Khan AnasKhan Anas (Salesforce Developers) 
Hi Sekar,

Greetings to you!

Please refer to the below links which might help you further with the above requirement.

https://www.sfdcstuff.com/2018/08/remote-site-settings-way-to.html

https://salesforce.stackexchange.com/questions/51566/query-remote-site-setting

http://www.exceptionlesscode.com/how-to-create-remote-site-settings-through-apex/

http://technome2.blogspot.com/2017/05/creating-remote-site-settings.html

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas
SEKAR RAJ.SEKAR RAJ.
Hi Khan,
Thanks for your response.
All the above links are explaining how to create/update remote site settings.
But I need to query like 100 remote site setting records and have to update them by using Apex after sandbox refresh.

Thanks,
SEKAR RAJ
Yogeshwar TailorYogeshwar Tailor
Hi Sekar,

Use tooling api...

/services/data/v45.0/tooling/query/?q=select+id,EndpointUrl,isActive+from+RemoteProxy

Eg : https://salesforce.stackexchange.com/questions/15843/tooling-api-usage-in-salesforce-apex-method

replace the url in that example.

from workbench you can test it.
User-added image

let me know if you face any issue.

Thanks,
Yogesh
This was selected as the best answer