mysql - How to post data to the table from POSTMAN client -


i developing shoppingcart application in spring-data-rest. testing application postman client. in application have cart table , cart_item table. cart_item table has cart_id field id cart. able put data cart , cart_item individually. not interested put data individually. hoe can send cart data , cart_item data in single json.

i able insert cart table following json: cart url in postman: http://localhost:8080/sportsrest/carts

{   "date": "2015-10-10",   "totalamount": 1000,    "createdat": "2015-04-06t18:30:00.000+0000",    "updatedat": "2015-04-09t18:30:00.000+0000",    "sport":"http://localhost:8080/sportsrest/sports/1",    "user":"http://localhost:8080/sportsrest/users/9090909090",    "tenant": "http://localhost:8080/sportsrest/tenants/2"   } 

for cart_item: http://localhost:8080/sportsrest/cartitems

  {   "rate": 500,   "quantity": 2,   "amount": 1000,   "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/901",   "merchandisetype":"http://localhost:8080/sportsrest/merchandisetypes/1"   } 

how can put data cart , cart_item table single json request?

i tried following way cart being added cart_item not created in cart_item table: url: http://localhost:8080/sportsrest/carts

  {    "http://localhost:8080/sportsrest/cartitems":       {        "rate": 50,        "quantity": 1,        "amount": 50,        "createdat": "2015-04-12t23:40:00.000+0000",        "updatedat": "2015-04-14t21:35:20.000+0000",        "merchandise": "http://localhost:8080/sportsrest/merchandises/10",        "merchandisetype":"http://localhost:8080/sportsrest/merchandisetypes/1"         },      "date": "2015-10-10",      "totalamount": 99898,      "createdat": "2015-04-06t18:30:00.000+0000",      "updatedat": "2015-04-09t18:30:00.000+0000",      "sport":"http://localhost:8080/sportsrest/sports/1",      "user":"http://localhost:8080/sportsrest/users/9090909090",      "tenant": "http://localhost:8080/sportsrest/tenants/2"    } 

can please me..

thanks in advance

postman great tool talk apis, won't need do. seems need more building http request (that's postman do).

the approach see be:

  • send put carts api
  • store card_id response
  • send put cart_item using card_id (from first request)

there number of ways outside of postman, 1 option easy if in linux/mac environment use curl/awk/grep


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -