This documentation is for WSO2 Data Services Server 3.0.0. View documentation for the latest release.

CSV

CSV (Comma separated Text file) provides an easy way of storing simple tabular data. The sample csv file used in this example is hosted by USGS, the science organization which hosts latest earthquake information in CSV files online.

Follow the instructions below to create a data service using a sample CSV file as the data source.

1. Log on to the product's management console and select   "Data Services -> Create" under the "Main" menu.

2. The Create Data Service page appears. Fill in the fields and click Next . The Data Service name is mandatory.

For more information on advanced configurations, refer to  Advanced Data Service Configurations.

3. The "Data Sources" page appears. Click on the "Add New Data Source" link and add your Data Source details. Select the data source type as CSV. For example,

We use a sample file hosted online but you can also use one in your local machine.

Column Separator Values

  • Single Character = "X" (X is any character), e.g. ","
  • Tab = "\t"
  • Space = "\s"
  • Any Unicode Character = "\uXXXX" (XXXX is the hexadecimal unicode value)

4. Click Save . The added data source page appears. You can edit or delete the Data Source. To proceed click "Next."

5. The "Queries" page appears.

Initially your service does not include any queries. Click on "Add New Query" to add a new query, input/output mappings, events etc. to your Data Service. Enter query details according to the structure of the response you want.

In the following example, we have used "Grouped By Element" , "Row Name" and "Row namespace ".

For information on adding validations to your input mappings in the query, refer to section Input Validators . Also, detailed information on writing queries can be found in section Data Service Queries.

6. Once a new query is added, it will be listed in the "Queries" window. For example,

You can edit or delete your query. To continue, click "Next" .

7. The "Operations" page appear s. Click the "Add new operation" link to c reate an operation. Select a query to be executed when this operation is called.

Click Save once done. For example,

8. The operation will be listed in the "operations" page. 

9. The Data Service configuration is done. Click "Finish" . ( You can continue to add resources by clicking the "Next" button if you like)

10. You will be navigated to the "Deployed services" page .

From here, you can manage your data service . For instructions, refer to section Service Management . For a demonstration on service-enabling a CSV file, refer to CSV Sample .

Copyright © WSO2 Inc. 2005-2013