4D Blog

Home Tips Test the powerful 4D REST server with Postman

Test the powerful 4D REST server with Postman

March 25, 2020

Tips

4D provides a powerful REST server that enables direct access to data stored in your 4D databases. This makes it possible, for example, to build an API to use with a modern front-end technology (e.g., Angular, React, etc.). In this blog post, we’ll provide the first introduction to the 4D robust REST server. You’ll see how to configure it and test the create, retrieve, update, and delete (CRUD) operations using the API testing tool, Postman.

Configure the REST server

NOTE: If you already know how to configure a REST server and 4D database, you can skip the next two sections.

To make use of the 4D REST server, you’ll need to configure it first (a single click to get up and running). Simply check the” Expose as REST server” option in the “Web/REST resource” page of the database settings for REST requests to be processed:

Create and configure the 4D Database

  • This step assumes that you’ve already created a database and activated the Rest server. Go to your structure and create a new table [Tasks], with two attributes: Title (Alpha) and Complete (Boolean). By default, all tables are exposed in REST:

Important: table and field names must be JSON-compliant (no diacritical characters or spaces).

blank

  • Now, go ahead and create input and output forms. Enter some tasks in the Tasks table.
  • From the Run menu, select Start Web Server (if it’s not already started), then select Test Web Server.
  • Congratulations! You can now read and edit data within 4D using only REST requests.
    How can you tell? Easy, open a web browser, and after the ADDRESS:PORT, insert “/rest“. (All 4D REST URL requests start with /rest).
    For example, If you want to get all entities of the [Tasks] dataclass, you can proceed as follows:

blank

Testing the API with Postman

The amazing thing about the 4D REST server is that the API provides the CRUD (and more!) operations … ready to go! Not a single code line is needed to create, read, update, or delete an entity. Everything is set up for you. As we all know, CRUD is the most important group of database operations since they’re the main functions users need to create and manage data.

To test this amazing API, we’ll use Postman (an excellent tool for testing RESTful APIs). Postman offers a sleek user interface to make HTML requests, such as GET, POST, PUT/UPDATE, DELETE, and various other request methods.

Note: Using Postman is straightforward, however, check out this video if you need help getting started.

GET the list of tasks

Once Postman is downloaded, launch it, and we’ll create our different requests. We’ll begin with the most obvious request: Retrieving the list of tasks (from our [Tasks] table). As stated earlier, to get all entities of the [Tasks] dataclass, be sure to insert /rest/NameOfTheDataclass after the ADDRESS:PORT.

  1. Choose the method GET from the list of methods
  2. Copy the URL
  3. Click send
  4. Voilà:

blank

As you can see, not a single line of code is needed to retrieve the list of tasks!

Create a new task

We can also add a new task to our dataclass … also without code. The API is already set for you! 

To create a new entity, this URL will fire up a new post request: ADDRESS:PORT/rest/NameOfTheDataclass/?$method=update. To do so, we need to send a JSON request to the application. If you check the results from the GET request, you’ll get an idea of the keys needed to create a new task. So following this logic, we’ll only need the title and the complete fields; 4D takes care of the rest (key, timestamps, stamp, and ID).

  1. Change the method to POST
  2. Insert the URL
  3. Click send
  4. Add your new task
  5. Make sure that success = true!

blank

Go back to the first tab (GET method), click Send, and verify that the task has been added. You can also go to your 4D output form to see if the new task has been added!

blank

Update a task

To update an entity, we’ll use the same method that we used when creating the entity. $method=update allows you to update one or more entities in a single POST. To do so, you need to pass the __KEY and __STAMP parameters in the object along with any modified attributes.

In our example, we’re done reading one of Hemingway’s most enduring works: The Old Man and the Sea. Therefore, we need to change the complete status of the task to true. Easy:

blank

 

Delete a task

Deleting an entity is also straightforward. In our example, we want to delete the task with ID = 3 (called “test”). No problem! Call the delete method and specify it using its ID: dataclass(ID)?$method=delete.

blank

Go back to your 4D database and verify that the entity has been deleted! It’s gone, isn’t it?

What’s next

As you can see, the 4D REST server is mighty. It provides a rich API beyond what we’ve just demonstrated. There’s much more that can be done in a short time. Check out the detailed documentation. I’ll share a tip on authentication in upcoming blog posts, then a full front-end application written in ReactJS with REST for web access to the 4D database.

Discuss

Tags Programming, REST server, Web

Latest related posts

  • September 15, 2025

    Find the right spot in your 4D Write Pro document with AI

  • September 2, 2025

    Intelligent 4D Write Pro document analysis with AI

  • August 25, 2025

    ORDA – Constructor and touched event – Detailed behaviour through a network

Avatar
Intissar Elmezroui
- Product Marketing Manager – Intissar joined 4D in 2017 as a Product Marketing Manager. She works closely with the product, marketing, engineering, and technical support teams to highlight the “why,” “how,” and “what” of new features and updates to various audiences. This close collaboration enables her to craft messaging frameworks and create in-depth content and code samples for the 4D blog and website. After earning a degree in Computer Engineering from VINCI University, Intissar worked at several startups as a software engineer. Her hands-on experience includes software specification, design, and development, user training and support, as well as team management.
  • Deutsch
  • Français
  • English
  • Português
  • Čeština
  • Español
  • Italiano
  • 日本語

Categories

Browse categories

  • AI
  • 4D View Pro
  • 4D Write Pro
  • 4D for Mobile
  • Email
  • Development Mode
  • 4D Language
  • ORDA
  • User Interface / GUI
  • Qodly Studio
  • Server
  • Maintenance
  • Deployment
  • 4D Tutorials
  • Generic
  • 4D Summit sessions and other online videos

Tags

4D-Analyzer 4D AIKit 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R10 21 21 R2 Administration AI Artificial Intelligence Build application Class Client/Server Code editor Collections Compatibility settings Formula Listbox Logs Mail Network Objects OpenAI ORDA PDF Pictures Preemptive Programming REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience vscode Web Word processor

Tags

4D-Analyzer 4D AIKit 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R10 21 21 R2 Administration AI Artificial Intelligence Build application Class Client/Server Code editor Collections Compatibility settings Formula Listbox Logs Mail Network Objects OpenAI ORDA PDF Pictures Preemptive Programming REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience vscode Web Word processor
Subscribe to 4D Newsletter

© 2026 4D SAS - All rights reserved
Terms & Conditions | Legal Notices | Data Policy | Cookie Policy | Contact us | Write for us


Subscribe to 4D Newsletter

* Your privacy is very important to us. Please click here to view our Policy

Contact us

Got a question, suggestion or just want to get in touch with the 4D bloggers? Drop us a line!

* Your privacy is very important to us. Please click here to view our Policy