Skip to main content
All docs
V24.1

Test the Web API with Swagger or Postman

  • 2 minutes to read

Use the Swagger UI to Test the Web API

If your solution includes a Web API project, right-click the project in the Solution Explorer and choose Debug | Start new instance to run the Web API project. A browser displays the page with the available endpoints.

If your solution includes a startup Blazor Server project that contains the Web API, run the application. Add /swagger to the application address (for example, https://localhost:44318/swagger ) and press Enter to display a page with available endpoints.

Refer to the following link for more information on the page’s UI: Swagger UI.

The default configuration starts the Web API service on different ports depending on the project:

Project

Default Port

Example

Web API project

44319

https://localhost:44319/swagger

Blazor Server project

44318

https://localhost:44318/swagger

XAF Web API

Test the Web API. Expand the GET ApplicationUser endpoint and click the Try it out button. The Execute button is displayed. Click this button to see the result.

Test the Web API Service

Use the Postman Tool to Test the Web API

You can also use the Postman tool to test the Web API. The Postman tool is more flexible and allows you to send complex requests with parameters to the Web API service. Refer to the following link for more information on how to utilize this tool: Sending your first request.

Tip

To test the Web API service hosted on localhost, install the Postman desktop agent as described in the following topic: Installing the Postman desktop agent.

The image below shows a request to the Contact business object filtered by FirstName in the Postman Web UI (https://web.postman.co/home):

Use Postman to create a Web API request

See the following topics for more information on OData query options:

If you enable authentication for your Web API service, specify the authorization settings for the Postman tool. See the following topic for details: Specifying authorization details. If the Web API service uses the XAF JWT token from the “Authenticate” endpoint, copy it from the Swagger UI page as described in the following section: Use the Swagger UI to Test the JWT Authentication.

See Also