You are defining global class Records in method doGet(), simply this is not allowed. You have to include your inncer class "Records" directly one level into class "MyRestResource. So could will be like ...
@RestResource(urlMapping='/fetchAccounts/*')
global with sharing class MyRestResource {
@HttpGet
global static List<Records> doGet() {
}
global class Records
{
}
}
hi ashish dev i m wrote code same pattern but i got the error Compile Error: unexpected token: 'global' this is my code; @RestResource(urlMapping='/fetchAccounts/*') global with sharing class MyRestResource {
You are defining global class Records in method doGet(), simply this is not allowed. You have to include your inncer class "Records" directly one level into class "MyRestResource. So could will be like ...
@RestResource(urlMapping='/fetchAccounts/*')
global with sharing class MyRestResource {
@HttpGet
global static List<Records> doGet() {
}
global class Records
{
}
}
You are defining global class Records in method doGet(), simply this is not allowed. You have to include your inncer class "Records" directly one level into class "MyRestResource. So could will be like ...
All Answers
1) If you define 2 classes in one file on same level, like below
2) If you define classes more then one level deep, like below.
i m wrote code same pattern but i got the error Compile Error: unexpected token: 'global'
this is my code;
@RestResource(urlMapping='/fetchAccounts/*')
global with sharing class MyRestResource {
@HttpGet
global static List<Records> doGet() {
global class Records
{
}
}
}
You are defining global class Records in method doGet(), simply this is not allowed. You have to include your inncer class "Records" directly one level into class "MyRestResource. So could will be like ...