Below is the code for getProductsAPI. In this example we are calling a server script xe.Product which has a method called find which will return the list of all products.
Below is the code for postProduct API. In this example allows user to make a product. In this code we retrieve the form values storing product details and pass it to a server script called xe.Product which has a method called save which will save the product details to the database.