400 bad request after URL encoding

时间:2017-12-18 08:28:42

标签: java rest postman

I am consuming REST web services in my java code. Before make call to Rest web service I am encoding my query parameters by java.net.URLEncoder

But by request is getting failed by 400 bad request exception

URL before encoding : main(){ float k; int i=1, j=2; k = GetSum(i,j); } float GetSum(int x, int y){ float z; z = *((float*) &(x)) + *((float*) &(y)); /*it is working --> compile with this line*/ z = (float)x + (float)y; /*it is not working --> not compile with this line*/ return z; }

URL after decoding : host?limit=200&filter=published ge "2017-12-15T16:50:34.034Z" and (action.objectType eq "core.user_group_member.user_add" or action.objectType eq "core.user_group_member.user_remove")

I am tried same from postman rest client tool there also without encoded url is working and encoded url failed with 400 bad request error.

2 个答案:

答案 0 :(得分:0)

In postman you need to encode manually relevant parameters' values as follows:

Right click on a piece of selected text, and select “EncodeURIComponent” to manually encode the parameter value.

答案 1 :(得分:0)

"limit=200&filter=" doesn't need to be coded.