# Enabling API platform for customers

The API platform is a tool that helps Workato's Workato Embedded partners securely expose content or micro services to their customers. It can be used to enable use cases that extend their product's functionality by building recipes triggered by API endpoints.

The guide below will cover all the concepts and platform API endpoints required to enable API platform in customer accounts programmatically.

To enable API platform for customers is the process of:

  1. Creating API endpoint recipes and collections
  2. Creating customer accounts
  3. Importing the recipes and collections to customer accounts
  4. Creating client/access profiles in customer accounts
  5. Starting recipes and activating the endpoints

# Creating API endpoint recipes

Admin console Select 'Build an API endpoint recipe' as the recipe starting point

All API endpoint recipes that need to be imported into all/most customer accounts should be built and tested in the Workato Embedded partner's admin account. They should also be created within the same folder to simplify the export/import process.

The first step in setting up an API endpoint is to create a recipe that uses the API platform - New API request trigger. Click the Build an API endpoint starting point to automatically select this trigger.

The next step is to organize these recipes into one or more API Collections. Generally, an API Collection should contain endpoints whose access pattern has some common features, so that you can manage them together. For example, a set of Salesforce endpoints that are intended to be called by recipes used with the Sales team might be put together in an API Collection.

These endpoints should be activated and tested. Check out our API endpoint management and API collection creation guides for detailed information on building and activating these endpoints/collections.

Once all the endpoints are created and tested, use the Recipe lifecycle management tool to create a manifest that include all the collections and endpoints.

# Creating customer accounts

Once the endpoints are tested and ready, the next step will be to identify the customer accounts that require these API endpoints.

Customers can be created in the UI of the admin console or more commonly with these Manage customer accounts platform APIs. The user ID obtained in the response will be used in the next steps with the API platform APIs.

If viewing/creating the customer via the UI in the admin console, the customer ID is available in the URL of the customer info page.

Admin console Obtain the customer ID in the UI in the URL

Workato Embedded platform APIs

  1. To create the customer account: POST /api/managed_users

# Importing the recipes and collections to customer accounts

To import the recipes from the admin account to the customer account, a folder must first be created in the customer account. The folder created should be a top-level folder (nested 1 level within 'Home').

Thereafter, the manifest saved in the admin account can be used to export packages to be deployed in customer accounts. Once deployed in the customer account, the endpoints and collections in the package should now be successfully copied into the customer account.

Again, this can be done via the Workato UI or done with the following platform APIs:

Workato Embedded platform APIs

  1. To create the required folder in the customer account: POST /api/managed_users/:id/folders
  2. To export the required package from the admin account: POST /api/packages/export/:id
  3. To import the package into the customer account: POST /api/managed_users/:id/imports

# Creating client/access profiles in customer accounts

To enable these endpoints, API clients and access profiles must be added. Check out our client and access profile guide for detailed information on what they contain.

The collection imported in the previous step will be assigned to an access profile. Since each customer already has their own account, it is likely that only 1 default client and 1 default access profile have to be created. Thus, the following endpoints will only need to be called once.

When more collections are added in future, the access profile can be updated to include the new collection IDs.

Workato Embedded platform APIs

  1. Creating the API client: POST /api/managed_users/:id/api_clients
  2. Creating the access profile within the client: POST /api/managed_users/:id/api_clients/:api_client_id/api_access_profiles
  3. Updating the access profile: PUT /api/api_access_profiles

# Starting the recipes and activating the endpoints

Once the recipes are imported in the customer account, they must be started before the corresponding endpoints are activated. When they are activated, they can be called by the API client. Starting and activation can be done from the recipe UI, or programmatically with the endpoints listed below.

If the endpoints should no longer be accessible to the API client, the Workato Embedded partner may also deactivate the endpoints.