I am using a simple HTTP GET call in angularjs and passing some query string parameters.
One of the param is a date. Let's say "update" and the value passed is 03/20/2015.
When I make $http.get call passing the "update" as query string parameter,
the request is sent as
http://myservice.com/services/products?update=03%2F20%2F2015
I would like to send it as
http://myservice.com/services/products?update=03/20/2015
Any help is greatly appreciated.
I suggest to replace slashes with dashes in the date: 03-20-2015
here you can find some more informations
%2F is just the encoded url for '/', your back-end could decode it automatically.
Related
I need pass parameter like below
Http://host:port/wsintegration/id
Here I need to pass if value .
Please any one help how to do this .... Thanks in advance 😊
You haven't mentioned if you're using the Http Transport of REST adapter.
Assuming you're using the HTTP transport you can insert the relative URI parameter to replace the 'id'.
<http:relative-URI>{fn:replace('/wsintegration/id','id','YOUR_VALUE')}</http:relative-URI>
I'm having one Rest API: /myApp/fetchData/User-Name/Password. User-Name and Password will be changed based on the request.
When i call the above restapi like this
/myApp/fetchData/srikanth/Abcdef#g123
the request is going like this:
/myApp/fetchData/srikanth/Abcdef
Basically in the URL text got removed from # character. Is there any way to solve?
Thanks,
Srikanth.
In a URI the # triggers the begins of the "fragment", and ends the path. The fragment usually specify a portion of the resource identified by the path.
When you are post-ing the request from the client, you have to escape special characters. Your request should be:
/myApp/fetchData/srikanth/Abcdef%23g123
There are different way to escaping urls, like the encodeURI or encodeURIComponent function in JS. For example, you may do:
var request = "/myApp/fetchData/srikanth/" + encodeURIComponent("Abcdef#g123");
Then the server have to decode back to the original request.
But: are you sure it is a good solution to send the password plain in that way?
I'm getting null query parameter string even though passing query parameter string like this login?redirect=%2Farticles%2Fadd.
I have tried with $this->request->getQuery('redirect'); and $this->request->query('redirect'); but no luck.
Does anyone have any idea that where it would be wrong?
Looks like you are not setup your URL Route properly in your config/routes.php file. When you are interested to pass any route parameter to your controller action you should configure your route proper way. Although your question is not written detailedly.
I hope you will get much more information from this articles.
Passing Parameters to Action
I am trying to invoke a REST service which has a special character in its path params. The rest url looks like,
rest\fetchDetails\[1,2,3]
I am just invoking it using $http like,
$http.get('rest\fetchDetails\[1,2,3]');
It is not working and when I debug it using firebug I can see the url is sent as
rest\fetchDetails\%5B1,2,3%5D
Is there any way to send '[' and ']' when invoking $http calls?
Solution 1:
Try with post request and pass params in Post Request.
Solution 2:
'[]' are special characters for URL. So it will be encoded.
If you want to decode this are your server code you can do it.
You are actually sending '[' and ']', however they are being url-encoded by the $http.get method. The url-encoding is necessary because the HTTP standard only allows some characters (alpha-numeric plus some) to be sent non-url-encoded.
BTW, I assume the backslashes () in your URL are regular slashes (/) since otherwise they too would be url-encoded.
I have an extjs application that sends a parameter to an application setting with a slash... for eg "Tiger/Cheetah", to print a report... my ssrs report also takes that parameter fine... but when going through a web browser the passed parameter does not take "Tiger/Cheetah" with the slash... it takes "Tiger" but there are no records for that in the report...
I tried to replace / with %2f like this
Tiger%2fCheetah
and it's not working...
is there any other way?
Well this is easy
encodeURIComponent('Tiger/Cheetah')
and the other side must do vice verse
decodeURIComponent('Tiger%2fCheetah')
Have you tried escaping the slash with another slash? Try passing
Tiger//Cheetah
If you were using BIDS (VB), you could call REPLACE() to do this for you. I use this when passing parameter containing slashes or backslashes.
REPLACE(VariableName,"/","/")
try replace(Fields!SomeName.Value,"\","\"). It worked when i have record set having black slash value to be passed to a javascript URL
Peter J