How to create remote site settings through apex.
Step 1: Create a new class for Metadata Service, and copy the contents of attached Metadata Service file. MetadataService Step 2: Add the following endpoints to your remote site settings, It is required to callout the web service. https://c.ap1.visual.force.com https://ap1.salesforce.com Note:- Change sub domains of the endpoints according to your org. Step 3: Create a visual