I have a REST API built with Spring-boot
. I want to perform a post request using postman, but I'm getting the error:
"Unsupported Media Type".
I guess is related with the JSON, which should be bad form, but I can't imagine why. This is my JSON object:
{"id": 6,"name": "Jonh","pass": "464d83f2a73cc7068632fb46cbb0214538dec819","typeOfSubscription": "TRIAL_VERSION","partiesRemainingThisMonth": 1,"subscriptionEndDate": 2458078,"parties": []}
And this are the variables that I have defined of the object on the API:
private Integer id;private String name;private String pass;private TypeOfSubscription typeOfSubscription;private Integer partiesRemainingThisMonth;private Date subscriptionEndDate;private List<Party> parties;
TypeOfSubscription
is a enum with the following values:
NO_SUBSCRIPTION(0, 0, 0),TRIAL_VERSION(1, 1, 1),ONE_MONTH(2, 3, 1),THREE_MONTHS(3, 5, 3),SIX_MONTHS(4, Integer.MAX_VALUE, 6);private Integer id;private Integer partiesPerMonth;private Integer subscriptionMonths;
I don't find out why it's failing because the JSON looks good built. I suspect that the enum is involved, or maybe the date (I'm using Julian format).