Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • 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
titlePerforming batch requests

Follow the steps below to perform batch requests for the above data service:

  1. Log in to the Management Console of WSO2 EI using the following URL: https://localhost:9443/carbon.

  2. Select the ResourcesSample data service that is listed in the Services → List menu.
  3. Click Edit Data Service (Wizard) to open the wizard and select the Enable Batch Request check box.
  4. Click Next and save the changes.

The HTTP request sent to the data service to create several products using cURL would be as follows:

Code Block
curl -X POST -d '<_postproduct_batch_req><_postproduct><productCode>S10_172</productCode><productName>Suzuki</productName><productLine>Vans</productLine><quantityInStock>4222</quantityInStock><buyPrice>43.45</buyPrice></_postproduct><_postproduct><productCode>S10_173</productCode><productName>Honda</productName><productLine>Cars</productLine><quantityInStock>2564</quantityInStock><buyPrice>30.85</buyPrice></_postproduct></_postproduct_batch_req>' --header 'Content-Type: application/xml' http://localhost:8280/services/samples/ResourcesSample