Skip to Content

Publish Vinyl App as REST API Endpoint

Overview

In Vinyl you can configure a Vinyl server to be an API so that the application data can be accessed via an API Key. This feature allows you to create an API Key and Endpoints on applications. This guide will show an example using Northwinds data, and utilizes an API Key to connect to an Endpoint created in a selected application.

Note

This article outlines steps to publish Vinyl App as a REST API Endpoint. When you package a Vinyl app into an LP and deploy it in other environments, the Endpoint configuration in IDE > REST APIs will persist. All other configuration needs to be manually recreated in any additional environments.

How to Publish Vinyl App as REST API Endpoint

First you will need to set up a Security Provider API Key to provide authentication to access the Endpoints:

  1. Navigate to the IDE > Security Providers
  2. Click + User Authentication from the User Authentication panel
  3. Assign the provider a Name. For example: API Key
  4. Select API Key as the Type value
  5. Check to select Enabled
  6. Click Save

Depending on your use case you can configure the following Properties:

  1. If you want to type the API into your browser location bar for testing (not very secure), then
    1. Click + Property from the Properties panel
    2. Select AllowApiKeyInQueryString as the Parameter
    3. Enter True as the Value
    4. Click the checkmark to save the record
  2. If you are using HTTP, not recommended configuration, then you need to add the following:
    1. Click Create
    2. Select AllowInsecureHttp as the Parameter
    3. Enter True for the Value
    4. Click the checkmark to save the record

Next you will need to configure an Endpoint to access an applications data source:

  1. Navigate to IDE > REST APIs
  2. Click the Manage Endpoints button from Application panel
  3. Select the application where you want to configure the Endpoint. For example: Northwinds Design
  4. Click the pencil edit icon for the application
  5. Enter the Endpoint value into the Endpoint field. For example: Northwinds
  6. Click the Proceed button

Next you will Publish the Endpoint you created in the previous step:

  1. Navigate to IDE > REST APIs
  2. Click the Doc icon for the API to view information you will need later to connect to this Endpoint
  3. Click + Business Object from Business Objects panel and select a Table to set a value for the Endpoint. For example: Category (Source)
  4. Click the checkmark icon to save the record
  5. Click the Structure icon to control which fields are available in the API
    1. Uncheck Include By Default and/or delete field(s) entirely to limit access via API connection
  6. From the Tables panel, click the Open Record icon to expand and view Resource Details pop-up
    1. The Name of the resource will need to be appended to the Base URL and Endpoint from the API Document to retrieve this information
  7. Click Edit to set Default Get Limit or Get Max Limit, these values control the amount of records returned on GET calls to your API endpoint

Last, you will configure API Keys for specific Users:

  1. Navigate to IDE > User Management
  2. Select an existing User or Create a New User to use for the API call
    1. The User must be configured with the Login Type Interactive
    2. The User does not need to have Local Authentication
  3. On the selected/created User record click the Keys icon
  4. Click Create and select the API Key created in the first step as the Provider
  5. Click Save
  6. The generated Key is what the User will use to access the published API

Optionally, you can set up roles/security groups for the Object(s) being accessed as Endpoints.

To test or setup the use of your new API endpoints, use the API Key from the previous step, the Base URL and Endpoint information from the API document, and the Name from the resource details.

Restobject 8