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

Invalid type for Http* method: HttpGet

Hi Folks,

I am trying to create the API which can fetch the data from Salesforce and send it to an external system. For that, I am using REST web services HttpGet.
Below is the code I am trying to write.
global with sharing class DetailsController{
    global static List<Wrapper1> getDetails() {
        RestRequest req = RestContext.request;
        RestResponse res = RestContext.response;
        string GO, ID;
			GON = req.params.get('GO');
			throw new Utility.applicationException('GO Cannot be null');
			UCMID = req.params.get('ID');
			ID = '';
        List<Wrapper1> Details = fetchDetails(GO, ID);
        return Details;
The Wrapper1 hear is the Wrapper class which includes another wrapper class Wrapper2 in it.

global class Wrapper1 {
    public string GO;
    public string Name;
    public string Address;
    public List<Wrapper2> Fsets;
    public class OrderTrackingDetail{
        @AuraEnabled public string Carrier=System.label.CCP_NotAvailableValue;
        @AuraEnabled public string TrackingID=System.label.CCP_NotAvailableValue;
        @AuraEnabled public string fSetNum;
        @AuraEnabled public string trackingURL;
public class Wrapper2 implements Comparable {
    public string addressCity;
    public string addressLine1;
    public string addressLine2;
    public string addressLise3;
    public string addressLine4;
    public string addressState;
    public string addressZip;
    public string Name;
    public string Country;
    public List<Object> object1 = new List<Object>();
    public List<Object> object2 = new List<Object>();
    public Integer compareTo(Object objToCompare) {
        integer val1 = integer.valueOf(//something);
        integer val2 = integer.valueOf(((Wrapper2)objToCompare).//something);
        if (val1 == val2) 
            return 0;
        if (val1 > val2) 
            return 1;
        return -1;

When I am trying to write the gate method I am getting the below error.
Invalid type for Http* method: LIST.Wrapper1.LIST.Wrapper2.LIST.Object
How to solve this error.? Please help

Hi Nirav,

Use "Global" access modifier for Wrapper1, Wrapper2, and all public variables. This will resolve your problem.

Jitendra Kawale.

Hi Jitukawale,

Thanks for the suggestion, I have tried this but didn't get the success