Skip to main content

I need to write a SOQL Query for Remote Site Details that includes the Disable Protocol Security field. 

 

I know SF is getting away from Work Bench, but I would be using workbench to run the Query. 

 

#SOQL Queries 

1 件の回答
  1. 2025年10月1日 10:14

    Hi @David Vowels

    ,  

    Thank you for reaching out to the community.   

      

    This is not directly possible through SOQL unfortunately. This is a metadata which is fetched through tooling api, so in order to access through code we have limitation because we will receive the entire metadata as object of objects & the metadata field itself holds multiple properties in which one among them is your 'Disable Protocol Security' field. 

      

    So, I recommend you to please use the following script to get the details: 

     

    HttpRequest req = new HttpRequest(); 

    req.setEndpoint('replace_this_with_your_org_my_domain_URL/services/data/v60.0/tooling/query/?q=SELECT+Id,SiteName,Metadata+FROM+RemoteProxy+WHERE+SiteName=\'Replace_this_with_your_remote_site_setting_name\''); 

    req.setMethod('GET'); 

    req.setHeader('Authorization', 'Bearer ' + UserInfo.getSessionId()); 

    req.setHeader('Content-Type', 'application/json'); 

     

    Http http = new Http(); 

    HttpResponse res = http.send(req); 

     

    if (res.getStatusCode() == 200) { 

        Map<String, Object> results = (Map<String, Object>) JSON.deserializeUntyped(res.getBody()); 

        List<Object> records = (List<Object>) results.get('records'); 

         

        if (!records.isEmpty()) { 

            Map<String, Object> record = (Map<String, Object>) records[0]; 

            // The Metadata is a nested map of key-value pairs. 

            Map<String, Object> metadata = (Map<String, Object>) record.get('Metadata'); 

             

            System.debug('Site Name: ' + record.get('SiteName')); 

            System.debug('Endpoint URL: ' + metadata.get('url')); 

            System.debug('Disable Protocol Security: ' + metadata.get('disableProtocolSecurity')); 

        } 

     

    Because we can't access  Disable Protocol Security field directly due to metadata hierarchy this is the only way left to get your desired property value for that field. 

     

    Please feel free to let me know if you need any more help with this.  

      

    Please mark this as the best answer if it solves your issue. This will help the community consider this a reference and avoid creating multiple questions on the same concept.   

      

    Have a great day ahead!  

      

    Thanks & Regards  

    Nagarjuna 

0/9000