I am developing a application in Spring-data-rest. I am testing the POST requests from POSTMAN client to test whether the data is inserting into DB.In my DB i have a cartItems table. I am able to POST the data while i POST the JSON as Follows: merchandise, cart and merchandiseType are foreign key references.
{
"rate": 500,
"quantity": 1,
"amount": 500,
"createdAt": "2015-04-12T23:40:00.000+0000",
"updatedAt": "2015-04-14T21:35:20.000+0000",
"merchandise": "http://localhost:8080/sportsrest/merchandises/10",
"cart":"http://localhost:8080/sportsrest/carts/902",
"merchandiseType":"http://localhost:8080/sportsrest/merchandiseTypes/1"
}
But while i POST the data as below i am getting error: Instead of URL for merchandise i placed the merchandise JSON which i already tested the POST request for merchandise table JSON:
{
"rate": 500,
"quantity": 1,
"amount": 500,
"createdAt": "2015-04-12T23:40:00.000+0000",
"updatedAt": "2015-04-14T21:35:20.000+0000",
"merchandise": {
"id": 4,
"shortDescription": "white football",
"rate": 500,
"updatedAt": "2015-04-24T18:30:00.000+0000",
"createdAt": "2015-04-20T18:30:00.000+0000",
"longDescription": "test description for binary 1001",
"type": "1"
},
"cart":"http://localhost:8080/sportsrest/carts/902",
"merchandiseType":"http://localhost:8080/sportsrest/merchandiseTypes/1"
}
I am getting following ERROR:
{
"cause": {
"cause": {
"cause": null,
"message": "Template must not be null or empty!"
},
"message": "Template must not be null or empty! (through reference chain: co.vitti.sports.bean.CartItem[\"merchandise\"])"
},
"message": "Could not read JSON: Template must not be null or empty! (through reference chain: co.vitti.sports.bean.CartItem[\"merchandise\"]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: Template must not be null or empty! (through reference chain: co.vitti.sports.bean.CartItem[\"merchandise\"])"
}
Can some one please help me to why i am getting this error. Thanks.