So I need to make a POST call with Java to a REST Service. My code works fine, I am just writing in order to ask if there are better ways to do this, or if someone could refactor my code and make it more beautiful or with better performance.
I decided to user the Gson library, provided by Google.
I am giving an Employee Id and an email, phone, etc.
The input of the POST method should be in this format.
and the response I get is in this format:
So I wrote the following code, but I am uncomfortable with the input Json string... I mean what if i only want to send only one attribute (as following)
Then I have to do major adjustments in the code....
My code is the following. Any comments are welcome ! This is my first time to interact with REST/Json elements.