This documentation is for WSO2 Data Services Server 3.2.2. View documentation for the latest release.
Page Comparison - Exposing Data as REST Resources (v.4 vs v.5) - Data Services Server 3.2.2 - WSO2 Documentation

Versions Compared

Key

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

...

  1. Log in to the product's management console and select Data Services > Create under the Main menu.  
  2. Th Create Data Service page appears. Fill in the data service details as explained here and click Next.
  3. Similarly, navigate through the configurations for  data sources, queries and operations until the Resources window opens.

    Using this window, you can define RE
    ST resources that are accessed as RESTful Web services. For example,
    • Anchor
      resource_path
      resource_path
      Resource Path:
      The  The resource name that is appended to the end of the resource URI. There are two ways of giving the resource path:
      • Use a query path with the following format: <resource_path_name>/{Input_Parameter}
      • Use a query parameter by giving a name for the resource path. For example, enter Product, if you are querying for products.
    • Resource Method: The HTTP operation (GET, POST, PUT or DELETE)
    • Query ID: The corresponding query for the resource invocation

...

Code Block
{
    "_postemployee_batch_req": {
        "_postemployee": [
            {
                "employeeNumber": 5012,
                "lastName": "Smith",
                "firstName": "Will",
                "email": "[email protected]",
                "salary": 13500.0
            },
            {
                "employeeNumber": 5013,
                "lastName": "Peter",
                "firstName": "Parker",
                "email": "[email protected]",
                "salary": 15500.0
            }
        ]
    }
}

JSON objects in payloads

When sending payloads (JSON or XML) to a REST resource, the format of the object name should be as shown below. Note that the RESOURCE_PATH is optional. However, if the RESOURCE_PATH is specified in the payload, be sure that the slash used in the resource path is replaced by the underscore (_) sign in the payload. See the instructions on setting the resource path.

  • HTTP POST: _post<RESOURCE_PATH>_<RESOURCE_NAME> (E.g. _postwso2_employee)
  • HTTP PUT: _put<RESOURCE_PATH><RESOURCE_NAME> (E.g. _putwso2_employee)
  • JSON-based resource batch requests: _post<RESOURCE_PATH>_<RESOURCE_NAME>_batch_req (E.g. _postemployee_batch_req)