Test your API Using the REST Lab

You can test retrieval and update logic without writing programs, including provisions for REST parameters, using the REST Lab.
You can test retrieval and update logic without writing programs, including provisions for REST parameters, using the REST Lab. You can manage and test data using the REST Lab.
In this article:
Test Retrieval and Update Logic in the REST Lab
  1. With your API open, in the Tools section, click 
    REST Lab
     tab opens by default. The following image shows this page:
    Screen Shot 2017-06-15 at 6.58.17 PM.png
  2. Complete the following, and then send your request by clicking 
    , or 
    1. Select the endpoint on which you want to operate.
      The available endpoints are available.
    2. Select the named endpoint.
    You can specify the request content-type as application/json or application/xml.
    The JSON response appears in the 
     pane. For POST
    or PUT requests, the updated row is displayed in the JSON response. The status code and Content-Type are displayed. 
  3. Modify the response by selecting the 
     checkbox.For more information about this checkbox, see Response Formats.
Include Rule Summary, Transaction Summary, and Exclude Metadata
By default, REST requests include the rule summary and the transaction summary and exclude the metadata. You can specify whether REST requests include or exclude this information. To include this information in REST requests, select the 
Include Rule Summary
 checkbox, the 
Include Transaction Summary
 checkbox, and the 
Exclude Metadata
 checkbox. These checkboxes display when you select the 
You can revert to the default settings by clearing the checkboxes.
Retrieve Data with Filters or Sorts using GET
You can retrieve data with filters or sorts using GET. REST retrieval requests commonly specify filtering and sorting for the top-most resource. Because filters and sorts are coded into the URL, employ proper escape sequences.
You can specify filtering and sorting using the URL Encode/Decode tool.
Specify System Sorts, System Filters, and User Sorts
You can allow different types of named filters and named sorts. Specify system sorts and filters or user sorts and filters to your GET query.
Follow these steps:
  1. In the REST Lab, on the Request page, select the 
    The following image shows this checkbox:
    Screen Shot 2017-06-15 at 7.09.56 PM.png 
  2. Click 
    Add Filter
    The following image shows the options:
    Screen Shot 2017-06-15 at 7.13.21 PM.png 
  3. Choose 
     (system filter) and 
     (system sort) from the drop-down, and then enter your filter parameters. You can uppercase a specific system filter by adding the suffix 
    (for example, 
The following code snippet is a GET using a simple filter:
To test using 
 instead of named filters, turn on regular filters and sorts.
For more information:
The following code snippet is a GET request for customers with name < 'Shari', ordered by name (descending):
Depending on your database and settings, you might require quoted identifiers, such as shown in the following code snippet (for the 
http://localhost:8080/rest/default/demo/v1/demo:customer?filter="name" like 'A%'
Filters are SQL WHERE clauses, so you can use familiar functions such as 
Depending on the database type to which you are connected, there are other SQL syntax rules that can affect filter results. For example, you can interchange quotes for double-quotes, check for null (
), and put quotes around the column names. GET simplifies filter testing by providing automatic HTTP escapes.
Test Functions in the REST Lab
You can test your functions in the REST Lab. You can select top-level functions as endpoints from the list. For resource-oriented functions, you can enter the URL directly into the URL field.
 You can get to the REST Lab from the function.
  1. On the 
    By function
     tab, click the top-level function as an endpoint that you want to test from the list of functions. For resource-oriented functions, enter the URL directly in the REST Lab.
     tab appears.
  2. Click 
  3. To return to the 
     tab for the function, from the REST Lab, click 
Follow these steps:
  1. In the REST Lab, select the 
  2. Do 
     of the following, and then click 
      To select a top-level function as an endpoint
      , select the function from the list.
      The URL that displays in the URL field includes the parameters (string, number, boolean) for the function. Modify this URL with the parameter values that you want to pass into the function.
      To select a resource-oriented function
      , enter the URL for the function in the URL field.
Test Metadata Endpoints in the REST Lab
  1. In the REST Lab, select the 
    The metadata endpoints display. 
  2. Select the endpoint, and then click 
Investigate the Results of your Request's Logic
After updates, such as POST, PUT, DELETE requests, you can investigate the results of your request's logic by exploring the following summaries:
  • The transaction summary
  • The rule summary
For more information about how to display a summary of the rules that were executed in a transaction and how to obtain the rules summary, see Transaction Summary.
View Errors in the Response
Functions, JavaScript libraries, request/response events, and rules can throw errors. You can identify the source of these errors in the error message that is included in responses that return HTTP 500 status codes.
The following code snippet shows an example of an error message in the response that the 
 function throws:
errorMessage": "Error while executing Resource JavaScript API-level function MyFunction - line 18: ReferenceError: \"ConfigLib2\" is not defined in
at line number 18"
The following table lists the sources of error messages and the format in which they display: 
FU###-[Function name]
JavaScript libraries
LI###-[Library name]
Request/response events
RQ###-[Request/response name]
RU###-[Rule name]
Call your API using Other HTTP Client Tools
You can view examples of how to include the authentication token and call your API from common HTTP client tools, on the 
 tab, on the 
 pane toolbar, click 
How to call this API