0

How to get or list the API\ Web Service(Rest or SOAP) in Salesforce org ? I am using UL edition , and there are many packages installed, So I need make documents kind of report or list the available API\ Web Service(Rest or SOAP) both in and out.

Is there simple way to query or any free tool(workbench) will help me this.

2

You can use SOSL for this requirement. A basic search would just be to look for any ApexClass containing the relevant keywords. Here is a sample script:

Set<String> inbound = new Set<String>();
for (List<SObject> result : [
    FIND '@RestResource OR webservice' IN ALL FIELDS RETURNING ApexClass (Name)
]) for (SObject record : result) inbound.add((String)record.get('Name'));

Set<String> outbound = new Set<String>();
for (List<SObject> result : [
    FIND 'Http()' IN ALL FIELDS RETURNING ApexClass (Name)
]) for (SObject record : result) outbound.add((String)record.get('Name'));

Or, if terse isn't your thing, here is a more verbose version:

Set<String> inbound = new Set<String>();
List<List<SObject> results = [
    FIND '@RestResource OR webservice' IN ALL FIELDS
    RETURNING ApexClass (Name)
];
for (List<SObject> result : results)
{
    for (SObject record : result)
    {
        inbound.add((String)record.get('Name'));
    }
}

Set<String> outbound = new Set<String>();
List<List<SObject> results = [
    FIND 'Http()' IN ALL FIELDS
    RETURNING ApexClass (Name)
];
for (List<SObject> result : results)
{
    for (SObject record : result)
    {
        outbound.add((String)record.get('Name'));
    }
}

Of course, well versed developers may write utility classes which make callouts, so you may need to broaden your search based on the initial results.

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.