You need to sign in to do that
Don't have an account?
Rakesh M 20
Hi All, can anyone help me to find what is the error in this piece code please..
@RestResource(urlMapping='/v1/BookDetails/')
global class bookManager
{
@httpGet
global static Book__c doGetBook()
{
Book__c book = new Book__c();
Map<String,String> paramsMap = RestContext.request.params;
String bookId = paramsMap.get('Id');
book = [select Id, Name, Price__c from Book__c where Id IN =: bookId]; // getting sytax error in this line
return book;
}
}
global class bookManager
{
@httpGet
global static Book__c doGetBook()
{
Book__c book = new Book__c();
Map<String,String> paramsMap = RestContext.request.params;
String bookId = paramsMap.get('Id');
book = [select Id, Name, Price__c from Book__c where Id IN =: bookId]; // getting sytax error in this line
return book;
}
}
so try:
regards
Andrew
All Answers
Can you state the error you are getting in the above code so as to look further and respond back.
Looking forward to your response.
Thanks.
Following are the errors for that line
1) Unexpected token '='.
2) Unexpected token ':'.
3) Extra ';', at ']'.
4) Expression cannot be assigned
5) Expression cannot be a statement.
please look onto this
so try:
regards
Andrew
Its working now..