cancel
Showing results for 
Search instead for 
Did you mean: 

How to use REST services and call them in Cloud Application Studio

Former Member
0 Kudos

Hi Experts,

Can any one please help me in implementing the REST based services in the studio. Any document/video/blog can help me out in developing and testing the same.

Thanks in advance for the help on this topic!!!!

Regards

Hanu

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

H Experts,

Any suggestions/tutorials/pdf's/documents....? Waiting on this to create and perform a Rest based web service call in the studio.

Thanks in advance.

Regards

Hanu

Former Member
0 Kudos

Hi Hanu,

there is documentation and a tutorial in the SDK documentation.

Did you already have a look?

http://help.sap.com/saphelpiis_studio_1508/studio_od_1508.pdf

Chapter 8.14.5.7

Best regards,

Ludger

--

Custom development with all4cloud.de

Former Member
0 Kudos

Thanks Ludger,

I had already gone through this section on the SDK help document, but it didnt helped me out much in my case of Using REST services using API keys instead of user id and password and also at the same time I want to pass multiple values to the single query parameter in the URL, which is not working when tried to make a GET request to the service.

If I am passing one value for the query parameter call is successful and response is turning out to be "200" and content is also visible. Where as if the multiple parameters are passed in the request then all the values are suppressed with the last feed done to the parameters and only response is available to the last passed value of the request

Please let me know if further details needed on the above and at the same time if any other blog/detailed procedure wise document is available, it would help a lot in knowing much about the REST services.

Regards

Hanu

Former Member
0 Kudos

Hi Hanumath,

I had the same issue too and asked a question here regarding REST services and API-Key.

Unfortunatelly nobody answered.

From my understanding api keys are not supported using REST even though you can define them.

Regarding using GET and multiple parameters:

I did not experience this issue, however I did not use it extensively so I might have missed something.

Assuming your code is correct:

Did you try to build the URL manually (i.e. adding the parameters to the URL) instead of using the url parameter collection?

Imho if the later has an issue with multiple parameters then it should be possible to build your query string yourself.

Unfortunately I am not aware of any blog entry regarding REST services. I could have used them myself.

Best regards,

Ludger

--

Custom development with all4cloud.de

Former Member
0 Kudos

Thanks Ludger for the information on this. I tried it out and I am able to get the response for time being but I am not sure whether the followed procedure is the exact one to be followed or it differs..

Coming to the issue of Multiple Parameters, I am able to pass multiple parameters in the request in both the ways using URL manually with hard coded values as a string and collection of URL parameters too. Both the ways I am successful in getting the response only for last passed value in the parameter. i.e., I have three query parameters and each parameter has two or more parameter values to be passed and holds with it. In this case that last passed value in the parameter is suppressing the first values and the response is only for the last passed one.

Following is the structure I am using for pass multiple values to a single parameter

URLParameter.Name = "TargetCurrency";

URLParameter.content = "USD";

URLParameters.Add(URLParameter);

URLParameter.Name = "TargetCurrency";

URLParameter.content = "INR";

URLParameters.Add(URLParameter);

Please help me out if having any idea of passing multiple values for a single query parameter.

Regards

Hanu

Former Member
0 Kudos

Hi Hanumath,

What data type is URLParameter (since it is not of type NameAndValue)?

Imho the following code should work:


import ABSL;

var URLParameters : collectionof NameAndValue;

var URLParameter : NameAndValue;

URLParameter.Name = "TargetCurrency";

URLParameter.Value = "USD";

URLParameters.Add(URLParameter);

URLParameter.Name = "TargetCurrency";

URLParameter.Value = "INR";

URLParameters.Add(URLParameter);

Did you use the debugger to check whether the content of your URLParameters contains only the last or all of your currency pairs?

Best regards,

Ludger Bünger

--

custom development with all4cloud

Former Member
0 Kudos

Hi Ludger,

Its the same

// Set URL Parameter

var URLParameter : collectionof NameAndValue;

var URLParameters : NameAndValue;

URLParameters.Name = "TargetCurrency";

URLParameters.Value = "USD";

URLParameter.Add(URLParameters);

URLParameters.Name = "TargetCurrency";

URLParameters.Value = "INR";

URLParameter.Add(URLParameters);

I tried debugging this and I am able to see all the parameter values one by one as I added and in the obtaines response I am able to see the two currencies I am requesting but the reponse is available only for the last currency in the request.

My REST request is in following way and the same I can see in the response URL also.

https://www.XXX.com/rates/api/v1/rates/USD.csv?TargetCurrency=USD&TargetCurrency=GBP&api_key= MyAPIKey

I tried with JSON too but the same response I am facing with only one currency.

Any Clues

Regards

Hanu

Former Member
0 Kudos

Hi Hanu,

In order to analyse your issue with the REST service I tried to have a look at your pasted destination url expecting some currency converter and GAAH... it is NOT SAFE FOR WORK!

Everybody: Don't click the link above!!

however looking at the URL gave me this:

I think, you use your REST service wrong:

Maybe you should also add SourceCurrency once instead of TargetCurrency twice.

Best regards,

Ludger Bünger

--

Custom development with all4cloud.de

Former Member
0 Kudos

Hi Ludger,

Sorry for not mentioning the URL is a sample URL.

Coming to the Source currency adding, it is added to the URL, find the below EUR is my source currency. I used the same in SOAP UI and my REST client where I am seeing perfectly the response for both the requested currencies... Dont have an idea where I am going wrong in passing the request

https://www.XXX.com/rates/api/v1/rates/EUR.csv?TargetCurrency=USD&TargetCurrency=GBP&api_key= MyAPIKey

Regards

Hanu

Former Member
0 Kudos

I am sorry,

I am out of ideas.

Former Member
0 Kudos

no problem, will see anyone else is going to join the battle or not for some more time. Meanwhile if found any solution will post it here.. Thanks for your time.

Regards

Hanu