Tutorials & Examples Web-help Blog

Tip: How to call a REST API from EasyMorph


With the addition of the “PowerShell” transformation it’s become relatively easy to call various REST APIs from EasyMorph.

Below is a sample PowerShell script that obtains a list of categories from this Community forum, together with the number of posts in each category:

$headers = @{}
$response = Invoke-RestMethod -Method GET -Headers $headers -Uri https://community.easymorph.com/categories.json -ContentType "application/json; charset=utf-8"

foreach($category in $response.category_list.categories)
    Write-Output ($category.name + ", " + $category.post_count + " posts")

Note that Invoke-RestMethod automatically parses the obtained JSON and creates necessary properties in $response. Here is the structure of categories.json:

  "category_list": {
    "can_create_category": true,
    "can_create_topic": true,
    "draft": null,
    "draft_key": "new_topic",
    "draft_sequence": 32,
    "categories": [
        "id": 1,
        "name": "General Q&A",
        "color": "B3B5B4",
        "text_color": "FFFFFF",
        "slug": "uncategorized",
        "topic_count": 138,
        "post_count": 547,
        "position": 0,

Here is a result:

As an exercise, you can try obtaining the number of topics (not posts) for each category.

Read more:
Invoke-RestMethod (docs.microsoft.com)

Added a sample project:
rest-api-request.morph (1.3 KB)

Importing JSON files
Formula for currency converter
Get data from RabbitMQ


Trying to call an API do extract the data that will be transformed in Easymorph. Unfortunately, the data volume can be rather large until I get delta extracts working. So my question is:

Is there a limitation as to how much data can reasonably be returned from an API call?


Chris Martin


Hi Chris,

I believe it should handle up to low millions of records without problems but I didn’t test it on such data volume.


Hi Dmitry,

The situation I am working with is that I need to call an API which will return a csv file which I will then transform and write to a SQL database.

The call looks something like this:


This call returns my file which I then need to process.

This will be the file name: f0b1ad0a-e589-413e-bf9d-3fdaf7590df8.csv

I see the action for the API call, but I want to know if this is possible to do at this time?

Thank you,

Chris Martin


Hi Chris,

just to make sure I understand your question – are you asking if it’s possible to download a file via an API call from PowerShell in EasyMorph?


Hi Dmitry,

Yes. the API call will give me the closest to real time data while reducing points of failure. The scenario would be:

Morph action calls API via powershell
Data comes in as a csv file
Then processing flows as normal


Chris Martin


In this case you can use Invoke-WebRequest with the -OutFile option.


Invoke-WebRequest -Uri "https://easymorph.com/feed.rss" -OutFile "C:\Users\Dmitry\Desktop\feed.xml"

In your case it would be:

Invoke-WebRequest -Uri $uri -OutFile $fname


Hi Dmitry,

This looks great! Thank you so much!