+ Start a Discussion
bujjibujji 

Testing Apex Rest

Hi Guys,

 

I have written the apex rest class and while testing using url it is showing like "Invalid Session ID" or "session expired"

 

below is the code can body help how to test it.I done in dev console it is working fine and i getting proper data.

 

But i want in browser in xml format.

 

@RestResource(urlMapping='/Contact/*')

    global with sharing class MyRestResource1 {
    
    
    @HttpGet
            global static List<Contact> doMyUpdatedContacts() {
            RestRequest req = RestContext.request;
            RestResponse res = RestContext.response;
            
            List<Contact> con = new List<Contact>();
                           
                          con = [SELECT Id,Name,LastModifiedDate
                               FROM Contact
                               WHERE LastModifiedDate = TODAY
                               AND CreatedDate != TODAY];
                               
            system.debug('____________MyRestResource1 ______'+con);
            return con;
            }
    
    }

 

Thanks,

Bujji

emmadiemmadi

you can test Apex test using https://workbench.developerforce.com/login.php.Workbench will take care of the SSO

 

 

bujjibujji

Hi,

 

 

Thanks dude it is working and i am able to get the proper data.

But this result has to used by some other system.How can i give to them b'coz we don't have any xml data

Please tell me the solution for this.

 

Thanks In Advacnce,

Bujji