Working with API Data Transformation in Workflows – Assembled

Overview

This article covers how to retrieve data via GET requests, transform and manipulate arrays (including editing specific items), and submit the updated data through POST requests in Assembled workflows.

Core Concepts

Variables and Data Flow

The "Analyze case" Step

The "Analyze case" step is your most powerful tool for data manipulation. It can:

Step-by-Step Implementation

1. GET Request - Retrieve Data

Set up a Custom API step to fetch your data:

Note: If you want to capture the full response, use JSON path "." to return the entire payload as a single variable.

2. Analyze Case - Transform and Edit

Use an Analyze case step to manipulate your data

Variable configuration

Example variable descriptions

Edit single array item:

Using the data from {{api_response}}, find the artist with id: 2 and update their role_ids to [1, 3, 5]. Keep all other artists unchanged. Return the complete updated artists array.

Transform keys + edit array:

Using {{api_response}}:
1. Rename 'role_ids' to 'assigned_roles' in all artist objects
2. Find the artist named "Artist A" and change their status to "featured"
3. Add a new field 'updated_at' with {{todays_date}} to all artists
4. Return the complete transformed array

Multiple array operations:

Transform {{api_response}} by:
1. Remove any artists where status = "inactive"
2. For all remaining artists, add role_id 99 to their existing role_ids
3. Sort the array by artist name alphabetically
4. Return the final updated artists array

Conditional transformations:

Using {{api_response}}:
- If artist has role_ids [1,2], change to [1,2,3,4]
- If artist name contains "Senior", add role_id 99
- Otherwise, keep existing role_ids unchanged
Return the updated artists array

Data type conversions:

Transform {{api_response}} by:
1. Convert all id fields from strings to numbers
2. Change date fields from "YYYY-MM-DD" to "MM/DD/YYYY" format
3. Ensure role_ids is always an array (convert single values)
4. Return the converted data

Tips for array manipulation

3. POST Request - Submit Updated Data

Create another Custom API step for your POST request. In the body, reference your transformed variable, for example:

{
 "artists": "{{updated_artists}}"
}

Testing Your Transformations

Use the Preview button in the workflow toolbar and run the workflow with a previous case ID, test email, or test chat. This lets you check how data flows step by step:

  1. Verify that {{api_response}} contains the expected data
  2. Confirm that {{updated_data}} reflects the correct transformations
  3. Validate the POST payload

Common validation checks:

Best Practices

Writing clear instructions

Variable naming

Error handling

Troubleshooting Common Issues

Variable not found

JSON format errors

Array reference issues

Getting Help

For complex transformations or specific use cases not covered here, reach out to your AI Deployment Strategist team for personalized guidance and implementation support.