Legacy Knowledge Base
Published Sep. 10, 2025

Testing JSON Web Services in Liferay

Written By

Justin Choi

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.

This article documents the new implementation of JavaScript Object Notation (JSON) web services in Liferay Portal 6.1.x to test API methods. The only limitation is that to test any methods they must go through JSON.

A database other than Hypersonic will be required for API testing as Hypersonic is for testing and will not produce accurate results.

Resolution

To start testing:

  1. Start up the Liferay Portal and login as the administrator
  2. Once logged in, navigate to [YOUR_SITE]/api/jsonws (e.g. http://localhost:8080/api/jsonws)
  3. On the left is a list of Liferay APIs. Click on one.
    1. From here, the path, parameters, return type, and exception information for that API are displayed. On the bottom, users can run a search that will parse through the existing data in the database to retrieve that string.
  4. From the main API testing page—[YOUR_SITE]/api/jsonws—click on get-user-by-id (e.g. http://localhost:8080/api/jsonws?signature=/user/get-user-by-id-1-userId).
  5. In the bottom userId form, type in 10158, which is a default user upon installation of Liferay.
  6. Click Invoke

The result should be populated information in the Execute section.

agreedToTermsOfUse": true, "comments": "", "companyId": 10154, "contactId": 10159, "createDate": 1383249122000, "defaultUser": true, "emailAddress": "", "emailAddressVerified": false, "facebookId": 0, "failedLoginAttempts": 0, "firstName": "", "graceLoginCount": 0, "greeting": "Welcome!", "jobTitle": "", "languageId": null, "lastFailedLoginDate": null, "lastLoginDate": null, "lastLoginIP": "", "lastName": "", "lockout": false, "lockoutDate": null "loginDate": 1383249122000, "loginIP": "", "middleName": "", "modifiedDate": 1383249122000, "openId": "", "portraitId": 0, "reminderQueryAnswer": "", "reminderQueryQuestion": "", "screenName": "10158", "status": 0, "timeZoneId": null, "userId": 10158, "uuid": "b6e14dd2-93a5-4ed2-b8d6-f294e6e79724" }

Additional Information

Liferay Portal 6.2 User Guide: Remotely Accessing Liferay Services

Did this article resolve your issue ?

Legacy Knowledge Base