# API Recipes - Configuring Endpoints To Handle Raw Content


This guide is also applicable to Callable recipes set up as API endpoints.

Note: Callable recipes have been deprecated. They'll continue to function, but you won't be able to create new callable recipes. This guide uses the API platform connector, which functions exactly like the API fucntionality in callable recipes.

With the API Platform, you can configure your API recipes to accept raw content. This allows you to integrate more data types into your workflow, such as XML/SOAP.

In this guide, we'll walk you through creating an API endpoint that accepts raw content.

# Prequisites

To follow the steps in this guide, you'll need:

  • Access to the API platform feature. This is an add-on feature. Contact your Workato Customer Success Manager for more info.
  • API platform privileges.

# Step 1: Create An API Recipe


Sign into your Workato account.


Create a new recipe using the Build an API endpoint starting option. This creates a recipe with the API Platform - New API request trigger.


In the trigger's Request section, select text/plain for the Content type. This allows the endpoint to accept any data type sent to it.


Configure the trigger's Response:


For the Content type, select text/plain.


In the Responses section, add the responses the endpoint can respond with. For example: A Success response could respond with a 200 - OK HTTP status code.


Define other parameters for the endpoint as needed.

# Step 2: Parse The Request Body


If you don't need to use data received by the endpoint as datapills, skip to Step 3.

If you want to use data received by the endpoint as individual datapills, you can use Workato's data parsers. While Workato supports JSON parsing, it also supports CSV, XML, YAML.

For example: Our endpoint receives XML content, including a fileId property. We want to use the fileId to retrieve a file from Google Drive. Using the XML parser, we can parse the request body and convert the data into datapills we can use in subsequent steps.


Add an action step to the recipe, selecting the required parser as the App. In our example, that's the XML parser.


Provide a Sample document in the action's input.


In the action's Document field, add the Request body (raw) datapill from the trigger's output.

# Step 3: Define Response Bodies

In this step, you'll define response bodies for the responses you created in Step 1.

Note: If your endpoint has multiple responses, you'll need to repeat the steps in this section for each response type.


In the Response menu, select the response you created in Step 1.


In the Body field, add the data you want the endpoint to return in the response body.

# Step 4: Create An API Platform Endpoint

The last step is to expose the API recipe as an endpoint in the API platform. This will allow you to test it before releasing to production, ensuring it behaves as expected.


Navigate to API platform > API collections.


Create an API collection, if needed.


Once the collection is created, follow the steps in the Configuring A New API Endpoint guide to add the recipe as an endpoint.

That's it! Once added to an API collection, you can test the endpoint with raw content.

Testing REST endpoint with raw content Testing REST endpoint with raw content