jcoder
jcoder

Reputation: 73

RestEasy: Is it possible to use JSON Input format for GET request?

I want to use JSON as input and output format for the API's.

I am able to create webservices with HTTP POST method and Input format as JSON, but I am not able to do the same with HTTP GET request.

So, is it even possible to use JSON Input format for GET request ?

Upvotes: 0

Views: 453

Answers (1)

Birgit Martinelle
Birgit Martinelle

Reputation: 1889

Typically a GET request is used to retrieve a resource, it's not used to create or update it. That means you typically don't have to send a lot of parameters. In most cases you will send only an id as part of the URL (something like: https://myAPI.com/products/123 to retrieve product with id 123 for example) RestEasy allows you to read parts of the URL using @PathVariable. This link gives a quick summary on best practices: http://www.restapitutorial.com/lessons/httpmethods.html

Upvotes: 1

Related Questions