Wednesday, May 6, 2015

How to add special characters (space, +) in rest service url

If you are familiar using rest services you know that you can easily access the service through URLs.
As an example I take below URL as a rest service example,

Above sample service is use to send a message by using username. And we can test the service using a browser.

Let’s get in to the problem. Since this is a url, and we have to have web standard in the url. We cannot use any special characters that not allowed to use in a url. You may be need to put spaces in msg parameter. Also may need other characters like below example,


http://xxx.xxx.xxx.xxx:xxxx/message/send?username=xxxx&msg=Please Press 1+1

You can see the url is broken and cannot call the service successfully.

To overcome this problem we can use ascii values for these special characters.
To know more about ascii check below url,

After adding ascii values to above example, solution will be like below url,



Added %20 for space and %2B for + sign.


1 comment:

  1. I feel the combination of SQL and REST API really help people to know more about the onlooking aspects that can't be solved just through manual programming methods.

    SQL Server Load Soap Api

    ReplyDelete