Expose REST Service: Optional Parameters

Expose REST Service: Optional Parameters

  

Hello Everyone,

I'm trying to expose a REST Service with optional parameters. When I try to call the REST Service and sending the parameter in the URL, it seems that the parameter is not taken into consideration. It brings all data. 

E.g.  https://agltst07.corp.cyta/CMM_API/rest/xmldataout/movie_list_xml?lang=en&cat=1 returns the same set of date with  https://agltst07.corp.cyta/CMM_API/rest/xmldataout/movie_list_xml?lang=en

I've attached in the zip file 

  1. The aggregate behind the REST Service
  2. The REST service parameter when I expose the service
  3. The REST service parameter when I consume the service
  4. The results of testing the REST Service.

Please advise on how to set the parameter when exposing the REST service in order for the parameter value passed to work


Thanks

Marios








I believe it has to do with the Default Input Parameter Value, when exposing the REST API Method

Hi Mario,

It might indeed be related to the parameter's Default Value. What is the Default Value that you're currently using? For instance, if you have it set to "1", then you'll get the same records when calling the method with no parameters or with "cat=1".

?? Aurelio,


I want to leave the default value blank in order to be able to get all values, but I also want to pass a value for a specific subset of the results. Is there any setup I need to do in order to do that?

Marios


Mario,

Provided that you have your Aggregate correctly set up, leaving the default value empty should achieve that result.

Would it be possible for you to share the .oml that contains the exposed REST API, so that I can try to understand why it's not working?

Solution

Hi Aurelio,


I managed to solve the issue. It was the name of the parameter I was passing through the URL, which was different than the "Name In Request" value I entered in the REST API method


Thanks for the help!

Marios


Solution