Liqiud basics
Modules
API
Mailer
Booking API
On this page
Overview
You can get, update and delter orders and items with the Booking API.
Get order
Snippet
$.ajax
url: '/b/cart'
type: 'GET'
dataType: "JSON"
success: (data) ->
console.log "Order fetched", data
error: ->
console.log "Something went wrong, order not fetched"Update order
Snippet
$.ajax
url: '/b/cart'
type: 'POST'
dataType: "JSON"
data:
order:
start_at: start_at
end_at: end_at
booking_location_from_id: booking_location_from_id
booking_location_to_id: booking_location_to_id
success: (data) ->
console.log "Order updated", data
error: ->
console.log "Something went wrong, order not updated"Add item
Snippet
$.ajax
url: '/b/cart/items'
type: 'POST'
dataType: "JSON"
data:
order_item:
quantity: quantity
stock_item_id: stock_item_id
success: (data) ->
console.log "Item added", data
error: ->
console.log "Something went wrong, item not added"
Delete item
Snippet
$.ajax
url: '/b/cart/items?product_id=product_id'
type: 'DELETE'
dataType: "JSON"
success: (data) ->
console.log "Item deleted", data
error: ->
console.log "Something went wrong, item not deleted"Delete order
Snippet
$.ajax
url: '/b/cart/items'
type: 'DELETE'
dataType: "JSON"
success: (data) ->
console.log "Order deleted", data
error: ->
console.log "Something went wrong, order not deleted"
Cancel order
Snippet
$.ajax
url: location.pathname
type: 'POST'
dataType: "JSON"
success: (data) ->
console.log "Order canceled", data
error: ->
console.log "Something went wrong, order not canceled"
Updated: 2020-11-17