• Warjie Malibago 8
  • NEWBIE
  • 10 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
Hi All,

I've been stuck with this error for 2 days already.

I've been trying to test a fairly simple REST code in my workbench. But for some weird reason(s), it always show this error (attached)

Here's my code:
@RestResource(urlMapping='/v1/accounts/*')
global with sharing class SampleREST{
  
    @HttpGet
    global static AccountWrapper doGet() {
        RestRequest req = RestContext.request;
        RestResponse res = RestContext.response;
        
        AccountWrapper response = new AccountWrapper();
        
        response.acctList = [SELECT Id, Name FROM Account];
        response.status = 'Success';
        
        return response;
    }
    
    global class AccountWrapper{
        public List<Account> acctList;
        public String status;
        public String message;
        
        public AccountWrapper(){
            acctList = new List<Account>();
        }
    }
}

Of all the articles I've checked, they all point me into 1 direction and it hasn't worked either.

So I was thinking that it might be something that I setup or forget to setup before I had my class created?

Appreciate your help on this.User-added image
 
Hi All,

I've been stuck with this error for 2 days already.

I've been trying to test a fairly simple REST code in my workbench. But for some weird reason(s), it always show this error (attached)

Here's my code:
@RestResource(urlMapping='/v1/accounts/*')
global with sharing class SampleREST{
  
    @HttpGet
    global static AccountWrapper doGet() {
        RestRequest req = RestContext.request;
        RestResponse res = RestContext.response;
        
        AccountWrapper response = new AccountWrapper();
        
        response.acctList = [SELECT Id, Name FROM Account];
        response.status = 'Success';
        
        return response;
    }
    
    global class AccountWrapper{
        public List<Account> acctList;
        public String status;
        public String message;
        
        public AccountWrapper(){
            acctList = new List<Account>();
        }
    }
}

Of all the articles I've checked, they all point me into 1 direction and it hasn't worked either.

So I was thinking that it might be something that I setup or forget to setup before I had my class created?

Appreciate your help on this.User-added image