1

I am currently working on a tool where I need to access the metadata, for which i am using the tooling API and the SOAP API. I am trying to query and get the list of all the data.

I was able to figure out the details for most of the objects but I could not find a way to query Sharing Settings, Report Types, Custom Labels. Are these metadata variable through the APIs? If so can anyone provide the object names of these metadata in Tooling or SOAP API?

Thanks & Regards

1

Please have a look at MetadataService class documentation, This API mirrors as much as possible the API types and operations described in the standard documentation.

From MetadataService class:

For Custom Labels:

public class CustomLabels extends Metadata {
        public String type = 'CustomLabels';
        public String fullName;
        private String[] fullName_type_info = new String[]{'fullName','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        public MetadataService.CustomLabel[] labels;
        private String[] labels_type_info = new String[]{'labels','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] type_att_info = new String[]{'xsi:type'};
        private String[] field_order_type_info = new String[]{'fullName', 'labels'};
    }

For Report Type:

public class ReportType extends Metadata {
        public String type = 'ReportType';
        public String fullName;
        private String[] fullName_type_info = new String[]{'fullName','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        public Boolean autogenerated;
        public String baseObject;
        public String category;
        public Boolean deployed;
        public String description;
        public MetadataService.ObjectRelationship join_x;
        public String label;
        public MetadataService.ReportLayoutSection[] sections;
        private String[] autogenerated_type_info = new String[]{'autogenerated','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] baseObject_type_info = new String[]{'baseObject','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] category_type_info = new String[]{'category','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] deployed_type_info = new String[]{'deployed','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] description_type_info = new String[]{'description','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] join_x_type_info = new String[]{'join','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] label_type_info = new String[]{'label','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] sections_type_info = new String[]{'sections','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] type_att_info = new String[]{'xsi:type'};
        private String[] field_order_type_info = new String[]{'fullName', 'autogenerated','baseObject','category','deployed','description','join_x','label','sections'};
    }

For Sharing Rules:

public class SharingRules extends Metadata {
        public String type = 'SharingRules';
        public String fullName;
        private String[] fullName_type_info = new String[]{'fullName','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        public MetadataService.SharingCriteriaRule[] sharingCriteriaRules;
        public MetadataService.SharingOwnerRule[] sharingOwnerRules;
        public MetadataService.SharingTerritoryRule[] sharingTerritoryRules;
        private String[] sharingCriteriaRules_type_info = new String[]{'sharingCriteriaRules','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] sharingOwnerRules_type_info = new String[]{'sharingOwnerRules','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] sharingTerritoryRules_type_info = new String[]{'sharingTerritoryRules','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] type_att_info = new String[]{'xsi:type'};
        private String[] field_order_type_info = new String[]{'fullName', 'sharingCriteriaRules','sharingOwnerRules','sharingTerritoryRules'};
    } 
| improve this answer | |
  • @user3197916 There is a very nice way of saying Thank you in community by upvoting if it helps and marking it right if it solves your problem :P – Mr.Frodo Jun 6 '18 at 5:56
  • Is it also possible to filter the results in the query using a where condition similar to SOQL or tooling api? @Mr.Frodo – user3197916 Jun 6 '18 at 6:49
  • @user3197916 Not sure about that. You need to try it yourself. See the Metadata API documentation. It does have some good examples. Basically Metadata API is a Soap based API with help of it you can fetch, insert,update metadata. – Mr.Frodo Jun 6 '18 at 7:06

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.