+ Start a Discussion
ManojKumar MuthuManojKumar Muthu 

How to join two apex class into one?

Hi There,

I my trying to narrow down my query by have more than one filter, with a sing REST API that allows me to enter Status, Case Number and Keyword within a account.
Below the code,

@RestResource(urlMapping='/QueryFilterStatus/*')
global with sharing class QueryFilterStatus{
    
    @HttpGet
    global static List<Case> getCaseByyId() {
    RestRequest req = RestContext.request;
    RestResponse res = RestContext.response;
    String search_query= req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);
    List<Case> results = [Select id, Case_Owner_Name__c, OwneEmail__c, subject, Case_Type__c, 
                                        Code__c, Tracker__c, status, Version__c, type, priority, ContactEmail,
                                        ContactId, OwnerId, CaseNumber from Case where Status=:search_query];
                                                                             return results;
}

@HttpGet
    global static List<List<Case>> getCase() {
    RestRequest req = RestContext.request;
    RestResponse res = RestContext.response;
    String search_query= req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);
    List<List<Case>> results = [FIND: search_query IN ALL FIELDS RETURNING Case ( id, Call_Back_Type__c, IsEscalated, 
                                                                             Case_Owner_Name__c, OwneEmail__c, subject, Case_Type__c, 
                                                                             Code__c, Tracker__c, status, Version__c, type, priority, ContactEmail,
                                                                             ContactId, OwnerId, CaseNumber ORDER BY status, priority, type, Version__c, Tracker__c, OwneEmail__c, subject )];
                                                                             return results;
}
}

Can someone help me through this?