function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Satya sai sudhirSatya sai sudhir 

Hello this is the error "Arithmetic expressions must use numeric arguments " is the error Kindly help!

1) @RestResource(urlMapping='/trippleInteger/')
 2)  global class MyService {
   3)  @HttpGet
   4)  global static Integer trippleIt() {
    5)     String someNumber = RestContext.request.params.get('yourInteger');
   6)      return someNumber *3;
    }
}
Best Answer chosen by Satya sai sudhir
Neetu_BansalNeetu_Bansal
Hi Satya,

You can use Workbench 'https://workbench.developerforce.com/login.php' to call the service, using the url yourSiteUrl../services/apexrest/trippleInteger?yourInteger=123.

If your problem is solved, mark the answer as best answer and for another question, start a new thread. and provide me the link, I will definitely help you.

Thanks,
Neetu

All Answers

Neetu_BansalNeetu_Bansal
Hi Satya,

Make sure that your service will have the Integer value for param 'yourInteger' and use the following code:
@RestResource(urlMapping='/trippleInteger/')
global class MyService
{
	@HttpGet
	global static Integer trippleIt()
	{
		Integer someNumber = Integer.valueOf( RestContext.request.params.get( 'yourInteger' ));
		return someNumber *3;
    }
}
Let me know, if you need any other information.

Thanks,
Neetu
Satya sai sudhirSatya sai sudhir

@neetu thank you ma'am. Another question for you. How do I call this service ?
 
Neetu_BansalNeetu_Bansal
Hi Satya,

You can use Workbench 'https://workbench.developerforce.com/login.php' to call the service, using the url yourSiteUrl../services/apexrest/trippleInteger?yourInteger=123.

If your problem is solved, mark the answer as best answer and for another question, start a new thread. and provide me the link, I will definitely help you.

Thanks,
Neetu
This was selected as the best answer