...
- Get All Products - Use HTTP GET request to get all the products.
Resource Path : products
Resource Method : GET - Delete Product - Use HTTP DELETE request to delete a given product from the database.
Resource Path : product/{productCode}
Resource Method : DELETE
See About Data Services and Resources for details.
Building the sample
The sample data service ResourcesSample should be deployed using the instructions in Samples Setup.
Running the sample
The service can be invoked in REST-style via curl (http://curl.haxx.se). The following commands can be executed using the command line to invoke each of the resources.
Create Product
Code Block curl -X POST -d '<product><productCode>S10_111</productCode><productName>1969 Harley Davidson Ultimate Chopper</productName><productLine>Motorcycles</productLine><quantityInStock>7933</quantityInStock><buyPrice>48.81</buyPrice></product>' --header 'Content-Type: application/xml' http://localhost:9763/services/samples/ResourcesSample.HTTPEndpoint/product
Update Product
Code Block curl -X PUT -d '<product><productCode>S10_100</productCode><productName>1969 Harley Davidson Ultimate Chopper</productName><productLine>Motorcycles</productLine><quantityInStock>8000</quantityInStock><buyPrice>48.81</buyPrice></product>' --header 'Content-Type: application/xml' http://localhost:9763/services/samples/ResourcesSample.HTTPEndpoint/product
GET Product
Code Block curl -X GET http://localhost:9763/services/samples/ResourcesSample.HTTPEndpoint/product/S10_100
Get All Products
Code Block curl -X GET http://localhost:9763/services/samples/ResourcesSample.HTTPEndpoint/products
Delete Product
Code Block curl -X DELETE http://localhost:9763/services/samples/ResourcesSample.HTTPEndpoint/product/S10_100
Info | ||
---|---|---|
| ||
Follow the steps below to perform batch requests for the above data service:
The HTTP request sent to the data service to create several products using cURL would be as follows:
|