Skip to main content

REST API Example

Creating a Simple REST API Use Case in Unmeshed

This guide will show you how to use Unmeshed for REST API call chaining use cases.

Reference Video

Key Steps

  1. Access Process Definitions
    • Navigate to the "Process Definitions" section in Unmeshed.
  2. Create a New Process Definition
    • Click on "Add" to create a new process definition.
    • Name the process something unique
  3. Add REST Endpoint Call Task
    • Drag and drop the "HTTP GET" task into the process definition workspace.
  4. Customize Parameters
    • Customize the parameters to the API as needed.
  5. Save the Process Definition
    • Click on "Save" to save the new process definition.
    • Note: The first save will show all new changes; subsequent saves will only show changes (deltas).
  6. Run the Process
    • Click on "Run" to execute the process.
    • Open the execution link below the "Run" tab to view the execution details.
  7. Capture Output
    • Copy the status code from the output for use in the next step.
  8. Add a Second Execution Step
    • Return to the process definition and add another task.
    • Pass the copied status code as a parameter in double curly brackets (e.g., {{ steps.previous_step.output.statusCode }}).
  9. Save and Run the Updated Process
    • Save the updated process definition.
    • Run the process again to see the new execution with the passed parameter.
  10. Rename Tasks for Clarity
    • Customize the names of the tasks for better understanding (e.g., "order_service", "user_service", "shipping").
  11. Export the Definition
    • Copy the process definition in JSON format to save it in your codebase if needed
    • This allows for easy transfer between different Unmeshed instances (e.g., from development to production)
note

Ensure that all parameters are correctly named and formatted with double curly brackets when passing between steps, when in doubt, run a test and see if you see the expected value

tip

Use clear and descriptive names for each task to let anyone who looks at your workflow know what it means

note

Leverage an integration test to ensure that things work as expected long term. You can compose and schedule a test in Unmeshed itself!