Page 1 of 1

Service request parameters now returning name of parameter instead of blank.

Posted: Tue Mar 15, 2016 11:37 am
by Ole Henrik Oftedal

Hi!

I am now making versjon 2 of my app :-)
But I have come across a change in Appery builder that I have not seen before when setting up request parameters for a service.

In version one of my app I had a service like this (two parameters):
getprojects/searchfilter/numberofdays
So when I wanted to return all projects used the last 30 days the service looked like this.
getprojects//30
(Please observe the two "/" after each other. This gives med default values for that parameter in this service and in this case it means return all projects.)

But in the the last builder in the exctly same situation the name of the parameter are returned instead. In this example the name "searchfilter" with brackets on each side {searchfilter}.

I can check with javascript and I can trap the error. The value here is blank and not the text "{searchfilter}" as I had hoped. Returning a blank like "" is really what I want to do. But of course this takes me nowhere and will just give me back the error :-(

if (value =="") {
// My code for trapping error here:
return "";
}
else{
return value;
}

Please help.

Kind regards

Ole Henrik Oftedal
Timeflex Systemer AS
Sandefjord, Norway
http://www.timeflex.no
http://www.timeflex.com


Service request parameters now returning name of parameter instead of blank.

Posted: Thu Mar 17, 2016 11:06 am
by Serhii Kulibaba

Hello,

Please clarify, do you need to use URL like "getprojects/30" if "searchfilter" is empty?
If so - the best way is to use Service URL with only one dynamica parameter in curle brackets instead of two, and set it's full value in the only one place.


Service request parameters now returning name of parameter instead of blank.

Posted: Thu Mar 17, 2016 2:08 pm
by Ole Henrik Oftedal

Hi and thanks for your reply:-)

In my version 1 of my app I have a lot of service and most of them have two or three dynamic parameters. Is this not possible any more?

This is my service:
Image

And:

Image

I link to my Filter Searchbar on my page:

Image

If I put something in the searchbar i.e. "a*" means find all projects starting with an a. The service works perfect :-)

If I dont use the Searchbar (it is now empty) I see a very strange change. Then name of my parameters showup with curly brackets.

In firebug this looks like this,

mycomplete url + /GetProjects/E15F4429-E84A-4CD8-BA40-CC1DBE894034/%7BSearchFilter%7D/0?0.05126914993077055&SearchFilter=

Hmm. I see now that unique is not a dynamic parameter. So I have removed it. And to test I have also renamed "SearchFilter" to "SF" and tried to have alle parameters in the correct ordrer. But still the same problem:

mycomplete ur +/GetProjects/E15F4429-E84A-4CD8-BA40-CC1DBE894034/%7BSF%7D/0?SF=&unique=0.02394984377854478

SF is showing up after the ? and in the url it shows up like this ../{SF}/

Is there a bug here?

Ole.


Service request parameters now returning name of parameter instead of blank.

Posted: Fri Mar 18, 2016 10:33 am
by Serhii Kulibaba

Please remove all parameters after "?" from the URL, and add them to the request parameters tab. Appery.io automatically will add them to the URL


Service request parameters now returning name of parameter instead of blank.

Posted: Fri Mar 18, 2016 1:43 pm
by Ole Henrik Oftedal

Yes. I have done so. But it did not help.

My service is now only like this:

GetProjects/{Authorization}/{SearchFilter}/{RecentlyUsedProjects_Days}/{unique}

And the call displayed in Firebug is still wrong:

GetProjects/E15F4429-E84A-4CD8-BA40-CC1DBE894034/%7BSearchFilter%7D/0/0.06516039047382038?SearchFilter=

I know this happens if I have misspelled the word "SearchFilter" but it is not case here I also have the correct sign on the Request page (a question mark that says that this parameter will be replaced in the Url and not included as a Get parameter.

As already mentioned this service and the other services in the App have has been working perfect earlier (maybe a year ago) so this is very strange.

I only happens if Searchfilter is empty. If I have for example the text "myproj*" it works as it should.


Service request parameters now returning name of parameter instead of blank.

Posted: Mon Mar 21, 2016 10:20 am
by Ole Henrik Oftedal

Steps to reproduce:

A)
Create a new service.
On the settings page find some stupid name, doesn't matter what, and enter one dynamic path parameter for example "TextParam"

http://myservice.com/GoDemo/{TextParam}

B)
Make a new mobil page with one Input control and remove default "Input" text (no default text in input field) and a button so you later can invoke the service.

Make an instance of the service on DATA tab, and map the input field to the "TextParam" in the service. Let the service be invoked from the button OnClick event.

C)
Use Test App button and start Firebug. Now look what happens. Instead of two slashes you get slash + name of parameter + slash and then the query parameter at the end (!)

http://myservice.com/GoDemo/%7BTextPa...=

If you enter text in the input field then all works fine and as expected. But empty text is the problem. In earlier version of teh builder you got a simple and nice servicecall like this: myservice.com/GoDemo//

Why is this a problem for me?
I need to be compatible with Embarcadero DataSnap solutions (There are millons of Delphi Embarcadero users/developers out there) and I need to be backwards compatible with earlier version 1 of my solution. As I have already said, this bug was not there about a year ago or so. Can you escalete this problem so it can be fixed in newer versions of the builder?

Please please help :-)

(I know there is a lot of discussions on the net when and where to use parametere and which type in path (url) or in query parameters. People will not agree on this. The case is that Embarcadero Datasnap uses the path/url way to send parameters and I have to be compatible in the way of passing parameters (even though many people may say that this is not 100% REST service standard/idea))

Ole.


Service request parameters now returning name of parameter instead of blank.

Posted: Wed Mar 23, 2016 4:07 pm
by Serhii Kulibaba

You have to create a request parameter TextParam, if you use it in the URL of the service: http://myservice.com/GoDemo/{TextParam}
Please look at this documentation: https://devcenter.appery.io/documenta...


Service request parameters now returning name of parameter instead of blank.

Posted: Wed Mar 23, 2016 5:06 pm
by Ole Henrik Oftedal

Yes. This is of course what I have done. (I called it dynamic path parameter but the correct is as you say request parameter in dynamic url) Did you try to reproduce from my steps?


Service request parameters now returning name of parameter instead of blank.

Posted: Thu Mar 24, 2016 6:58 pm
by Serhii Kulibaba

Yes, I've reproduced it. We have reported it and will get back to you with the update as soon as possible.
This can take some time.

Please use workaround below for that:
Use only one request parameter in dynamic url.
E.g.: instead of URL http://myservice.com/{param1}/{param2}
use http://myservice.com/{params}

and add JS to the mapping of that parameter:
prevar param1 = Apperyio("param1").val();
var param2 = Apperyio("param2").val();
var result = "";
if (param1){
result += param1 + "/";
}
if (param2){
result += param2 + "/";
}
return result;
/pre

here param1 and param1 - names of input components


Service request parameters now returning name of parameter instead of blank.

Posted: Fri Mar 25, 2016 8:31 am
by Ole Henrik Oftedal

Thanks :)