Wally
Wally

Reputation: 47

Using GET method to retrieve data from API using a name

i'm building a REST API and was wondering how i would go about retrieving a user data by using his name. I currently have the URI example.com/rest/users/{name} , however if someone contain a slash in his name this wouldn't work. So How would i do this? (using Jersey)

Upvotes: 0

Views: 297

Answers (2)

Atul Kumbhar
Atul Kumbhar

Reputation: 1083

Can you check this one?

slashes in url variables

It mentions that

You need to escape the slashes as %2F

Upvotes: -1

Iliiaz Akhmedov
Iliiaz Akhmedov

Reputation: 877

You can do:

 example.com/rest/users?name={encoded name} 

Upvotes: 2

Related Questions