Previous Next JavaScript must be enabled to correctly display this content

## 18.5.2 Creating a REST Data Source

Create a REST Data Source from Shared Components.

To create a REST Data Source:

1. Navigate to the REST Data Sources page:
   1. On the Workspace home page, click App Builder.
   2. Select an application.
   3. On the Application home page, click Shared Components in the center of the page.
   4. Under Data Sources, select REST Data Sources.
2. On the REST Data Sources page, click Create.
3. Create REST Data Source - Select From Scratch and click Next.

   Tip:

   If you select As copy of an existing REST Data Source, select the application to copy from and follow the on-screen instructions.
4. General:
   1. REST Data Source Type - Select the REST Data Source type, which is either a built-in type or a type defined by a REST Source Plug-In. To learn more, review item Help for more details or see About REST Data Source Types.

      The REST Data Source Type determines what appears next. This example assumes, REST Data Source Type is set to Simple HTTP.

   2. Name - Enter a descriptive name for this REST Data Source.
   3. URL Endpoint - Enter the Endpoint URL (starting with `http://` or `https://`) for this REST Data Source.

      Tip:

      Do not add query string parameters by appending `?name1=value&name2=value`. These are configured on the Advanced wizard page after you configure Authentication.

   4. Open API URL - Enter the URL where the OpenAPI information is available. If populated, the REST Data Source uses OpenAPI/Swagger for discovery.
   5. HTTPS Host Name - The host name to be matched against the common name (CN) of the remote server's certificate for an HTTPS request. It can also be a domain name like `*.example.com`. If NULL, the host name in the given URL is used.
   6. Click Next.
5. Remote Server:
   1. Remote Server - Choose an existing Remote Server object. The HTTP Endpoint URL of a REST Data Source consists of the remote server (Base URL) and the service specific part. Remote Servers are stored as separate Entities. When multiple REST Data Sources share the same remote server, they can easily be redirected to another physical location (for example, from test to production) by just changing the base URL within the Remote Server definition..
   2. Base URL - This is the Base URL of the chosen Remote Server object. The HTTP Endpoint URL of this REST Data Source is made up from the Base URL and the service-specific path suffix below.

      For example:

      - `http://api.example.com:8080/myservices/test/`

      - `https://api.example.com/ords/scott/`

   3. Service URL Path - Enter the service-specific URL Path for this REST Data Source. The HTTP Endpoint URL is built by appending this to the Base URL specified in the Remote Server object.

      For example:

      - `/services/customers/`

      - `/products/4711/details`

   4. Click Next.
6. If REST Data Source Type is Simple HTTP, under Settings, select one of the following:
   1. Pagination Type - Select one of the following:
      - No Pagination

      - Page Size and Fetch Offset - Flexible pagination where the REST API allows the request a specific set of rows, using page size and offset ("start at row") parameters.

        The following shows typical URL. In this example, the URL requests page number 2 with a page size of 100, which leads to rows 101 to 200 being returned.

        `http://hostname.domain.com/path/to/rest_api?limit=100&offset=20`

        In the previous example, note that the parameters named `limit` and `offset` can be arbitrary and depend upon the REST API being used.

      - Page Size and Page Number - Pagination where the REST API allows the request a set of rows, using page size and page number parameters.

        URLs typically look like the following example which requests page number 2 with a page size of 100, which leads to rows 101 to 200 being returned.

        `http://hostname.domain.com/path/to/rest_api?size=100&page=2`

      - Page Number - Pagination where the REST API allows to request a set of rows, using a page parameter. The Page Size is fixed and determined by the REST API.

        URLs typically look like the following example which requests page number 2. If the REST API uses a fixed page size of 20, rows 21 to 40 will be returned.

        `http://hostname.domain.com/path/to/rest_api?page=2`

      - Page Size and Page Token - Pagination where the REST API allows to request a set of rows, using a combination of a page token and page size parameters. The token is used to retrieve the next set of rows, and is returned in the response body of the previous request. The page size determines the number of rows to return in each request.

        URLs typically look like the following example, which requests the next set of rows using the token `ApEx=` and a page size of `100`.

        `http://hostname.example.com/path/to/rest_api?token=ApEx=&limit=100`

      The UI changes based on Pagination Type you select. See field-level Help for more information on specific attributes.

   2. Click Next.
7. Authentication Required - Choose whether the new REST Data Source requires Authentication.

   Tip:

   To learn more about authentication, see About Supported Authentication Types in Protecting Web Credentials by Defining Valid URLs

8. To proceed, select one of the following:
   - Create REST Source Manually - This option does not include Discovery mode. Based on the previously entered information, a REST Data Source is created with a few sample operations and a sample data profile. This option creates an incomplete REST Data Source that is unusable with an APEX component. To correctly reflect the external web service, you will need to edit the operations and the data profile.
   - Advanced - Presents advanced parameters for the Data Profile. Use Response Sample to upload a sample JSON (or XML) response. Once a file is uploaded, APEX performs a Data Profile Discovery on the uploaded file.
   - Discover - Starts Discovery mode. APEX executes multiple HTTP requests in order to get information about the external Web service. One of these multiple HTTP requests can be an HTTP request to get the OpenAPI information about the Web service. APEX samples the data (JSON or XML) returned by the Web service and derives a Data Profile (consisting of metadata about the JSON attributes). Discovery results then display and confirms whether to create the REST Data Source.
9. If you click Advanced, the Parameter page appears.
   Use the Parameters page to configure initial REST Data Source parameters which might be required for discovery. Some REST Data Sources may require you set specific HTTP Headers (for example, `User-Agent`). After setting advanced parameters, select either Create REST Source Manually or Discover.
10. If you click Discover, APEX invokes the REST service URL and a Preview appears. From the JSON response, APEX derives attributes and their data types and uses this to create a Data Profile.

    The information that displays depends upon the complexity of the target service. For simple HTTP services or ORDS services which do not provide metadata about their JSON response attributes, APEX investigates the JSON or XML response, samples the data, and creates a proposal for a data profile. The Data tab displays the sample response data, formatted as a report.

    The columns tab shows information about the data profile columns APEX has found during discovery. Use this tab to verify whether the column data types are correct.

    If you wish to remove a named column you can navigate with the TAB key to the remove column and press Enter, or simply by using the mouse by pressing the X icon.

    The Response Body tab shows information about the response body structure APEX has found during discovery. Use this tab to verify the complexity of the structure in the response body that will be returned depending on the type of response received in discovery.

    Click More Detail to view additional detailed information about the REST Data Source response, such as the response body, response headers and the REST Data Source operations.

11. Click Create REST Data Source.
    The REST Data Source is created.

Parent topic: Managing REST Data Sources