Rest API Request with parameter value containing spaces must be filled with %20

I noticed that I got a 400 response when testing an API where the value set for the parameter was containing a space. URL in katalon looked like this:
http://..***:8080/geoservices/geo/geoLoc?address=grote markt 1 brussel

when pasting in chrome for example, it turns into:

http://..***:8080/geoservices/geo/geoLoc?address=grote%20markt%201%20brussel

which seems OK.

I think it would be useful that we could write spaces in our value field instead of %20 for every space. Can this be corrected?

You’re bumping into the HTTP spec here.

Usually, you can use either…

  • grote%20markt%201%20brussel

or

  • grote+markt+1+brussel

At the end of the day, if the API is asking for an HTTP string, you need to supply one.

Sure, you are right, but remark that SoapUI & Postman both accept me entering space and then translating the space into %20 behind the scenes. Would be more user friendly, imho.

I agree.

But then you start wondering, does the API do all required rewriting, or just some?

There’s a whole bunch of entity/oddities to consider, if you go that route. Like I said before, at the end of the day, if the API is asking for an HTTP string, you better suck it up and give it one (just for sanity’s sake).

1 Like

came to this thread while i facing the space issue as well.
so Katalon decided no solution for this at all?

I wouldn’t assume that, no. The API claims to do a certain job and it has certain requirements. You have to meet those requirements. That’s just how it is. Nothing much else I can say.