| << Click to Display Table of Contents >> Navigation: Languages > JavaScript > Tutorial > More Tutorials > REST Data | 
IntraWeb 17 provides built-in support for RESTful interaction with external APIs, allowing you to fetch, display, and interact with data from remote servers directly in your IntraWeb application. By leveraging HTTP requests, you can seamlessly integrate dynamic data from REST APIs into your app.
How REST Interaction Works in IntraWeb 17
IntraWeb's REST Data system enables your application to make HTTP requests to external REST APIs and display the received data in your user interface. The communication is based on standard HTTP methods (such as GET) and typically returns data in JSON format.
Here’s how it works:
1.You can send a request to an API endpoint directly from your IWML layout using the =HTTP(url) syntax. This automatically triggers a GET request and fetches the data for you.
2.After the data is fetched from the API, it gets bound to your UI components in real time. You don't need to write extra code to update the display, this changes appear automatically.
3.If needed, you can handle or transform the received data in your JavaScript logic. This allows you to filter, format, or process the content before presenting it to the user, giving you full control.
The system is designed to be simple yet powerful, offering seamless integration with REST APIs, regardless of the complexity of the external data source.
Examples of Using REST Data in IntraWeb 17
Fetching Data from a REST API and Displaying It
In this example, we fetch a list of users from a REST API and display their names and emails on the page.
ACORN 1.0 IWML 1.0
Page
Data[]
// Fetching user data from the REST API and binding it to the Users object
Data:Users
Text: =HTTP(https://jsonplaceholder.typicode.com/users)
SimpleStack Horizontal
SimpleStack
// Displaying the user's name
Text [b]Name
Edit:TempName =.Users.name
gap
// Displaying the user's name in the system
Text [b]Username
Edit =.Users.username
gap
// Displaying the user's email address
Text [b]Email
Edit =.Users.email
•=HTTP(https://jsonplaceholder.typicode.com/users): Sends an HTTP GET request to the specified URL.
•.Users.name, .Users.username, and .Users.email: Bind the fetched user data to the respective fields.
•This displays the user data in a structured layout (name, username, email) inside Text and Edit components.
