May 2018
Intermediate to advanced
334 pages
7h 25m
English
Great, now we have our object! It's now time to call the API /api/Orders with a POST request so that our order goes into the database, as follows:
// 3. Call POST /api/Orders.$.ajax({ url: 'http://localhost:57571/api/Orders', type: "POST", contentType: "application/json", dataType: "json", data: JSON.stringify(order), headers: { "Authorization": "Bearer " + accessToken }, success: function (result) { alert("Order Placed Successfully.") }});
If everything works correctly, you should see something like the following screenshot:

But we are forgetting something here; although our order has been placed successfully, we ...