In this tutorial, you’ll learn how to consume REST APIs in a Mendix native mobile app. We’ll connect to an external API, fetch the data, and display it on a native page with ListView.
Go to MX Studio Pro
Right click on API module -> Add Page (Native mobile) & give the name CRS_Data.

Now go to the CRS_Data page -> take a listview -> under the DataSource tab select a nanoflow as DataSource -> create a new nanoflow & give the name DS_BookList.

Go to DS_BookList nanoflow -> take a Call Microflow activity -> create a new microflow & give the name CRS_BookList.

URL :- http://localhost:8082/rest/prsgetapi/v1/GetApi

Open CRS_BookList microflow:-
1.Take a Call REST activity -> go to the general tab under location pass your URL & in the method select GET.

2.Double click on Call REST activity -> go to Response tab -> Apply import mapping & select your previously created import mapping(Book_Import).

*****IMP:-
Persistable entities are not allowed to return values when calling a microflow from a nanoflow on pages that are accessible through a native profile.
Create a NPE to return the list.

3.Go to CRS_BooList microflow -> take a Create list activity & select Book_2 NPE.

4.Take a loop & pass the BookList.

5.Inside loop take a create object & create NPE object-> assign the $IteratorBook/BookName inside this object.

6. Take a change list activity inside the loop -> select $ReturnList & add $NewBook_2 object.

7. Now return the $ReturnList.

8. Go to DS_BookList nanoflow & return the $BookList.

9. Go to CRS_Data page -> take a text & select BookName attribute.

Lastly, Go to Navigation -> Native mobile (tablet & phone) -> Add New Item -> CRS_Data & select CRS_Data Native Page.

Now run the application & test it.

Conclusion:
I hope this article has helped you understand How to Consume REST APIs in Mendix Native.
Thanks for reading this! See you in the next blog post.
You can explore the complete Consumed REST API Series here.
