432
Views
4
Comments
Solved
Display REST API response in List/ Table
Application Type
Reactive
Service Studio Version
11.53.25 (Build 61588)

I'm consuming a REST API that returns a list of tenants and I would like to display the response in a List widget.

The response is similar to this:

What I've done:

  • I consumed the REST API and have the response structure generated. The data type is correctly set to TenantAPIModel List
  • I add an action to "Fetch Data from Other Sources" in my interface and add the Server Action that calls the REST API in the Fetch action

Now my problem is I can't assign the response to the output variable. I thought I could use an Assign widget and do (Output Variable) Tenants = GetTenantsAPI.Response.

I have an output variable in the Fetch action, but I can't assign the Data Type to "TenantAPIModel List" only Tenant. So I'm getting an error 'Text' data type required instead of 'TenantAPIModel List'.

Why is the List not available for this structure? A more detailed guide in achieving this would be appreciated.

I'm also wondering what would be the best practice in integrating REST actually? Do we map the REST response to a domain model and have a core server logic that calls this REST API (So not calling the REST API from the interface action). I noticed the naming of the actions have to be unique even in different action category - I can't have GetTenants in REST API and also GetTenants in server action.

2016-04-22 00-29-45
Nuno Reis
 
MVP
Solution

Regarding your error, you have to select List (at the very bottom) and on the popup TenantAPIModel.

Usually the error is that the type needs to be public to be the output of a public action.

Yes, you have to compartmentalize. Create an IS module just to call the REST and a CS module to expose it as actions. (Naming explanation)


Apart from that, some knowledge of Architecture is advised before you start implementing a multiple module application.

UserImage.jpg
Adelia Benalius

Thanks, the pointer on selecting the List works

If I want to implement search & pagination to this list (but the API itself doesn't support search & pagination), what would be the best way to do this?

2016-04-22 00-29-45
Nuno Reis
 
MVP

The easiest option for a developer is to save into a list (like you're doing) and do the pagination/search over the list. For large number of records it can be heavy.

Because you mentioned pagination, I assume you want your data to be consistent on each fetch so I'd save it locally. It is usually advised to have the data closer to the user so if yuor data isn't highly mutable and you are allowed to duplicate data, go for it.

2026-03-12 06-20-48
KUNDAN CHAUHAN
Champion

Hi Adelia Benalius,

I am attaching an .oml file regarding this. please check it.

Or if possible then please share your .oml file.

Kind Regards,

Kundan Chauhan




ConsumeREST_API.oml
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.