Search code examples
web-servicesliferay

liferay 7 jsonws API dlfileentry obc parameter example


I wanto to try the web service of dflservice entry into the web service portal

http://localhost:8080/api/jsonws 

but the parameter used obc just explain as obc with the type com.liferay.portal.kernel.util.OrderByComparator, I try null, 0, +obc:com.liferay.portlet.documentlibrary.util.comparator.FolderNameComparator, but always have the same result:

Conversion failed: com.liferay.portal.kernel.util.OrderByComparator 

What is the correct parameter


Solution

  • According to documentation:

    1. You can't pass 0, as obc is an object type parameter.
    2. To pass a null value for obc, you need to prefix it with a dash like: /-obc.
    3. And to pass an instance of an object parameter, you need to prefix the parameter with a plus sign like: /+obc:com.liferay.portlet.documentlibrary.util.comparator.FolderNameComparator (Should work as well).

    As com.liferay.portal.kernel.util.OrderByComparator is an abstract class, you need to pass a concrete implementation. Check the implementation of DLImpl.getRepositoryModelOrderByComparator method for further concrete implementations of OrderByComparator class for document library.

    Also, I would like you to share the URI(s), you are trying. So, I can also try them.

    Reference:
    INVOKING JSON WEB SERVICES

    Update:

    There is bug in JSONWS GUI, which is already fixed in: https://issues.liferay.com/browse/LPS-76955?page=com.atlassian.jira.plugin.system.issuetabpanels%3Aall-tabpanel

    However, the URL access is working for me:

    http://localhost:8080/api/jsonws/dlfileentry/get-file-entries/group-id/10184/folder-id/0/status/0/start/-1/end/-1/+obc:com.liferay.portlet.documentlibrary.util.comparator.RepositoryModelNameComparator

    Here, com.liferay.portlet.documentlibrary.util.comparator.RepositoryModelNameComparator is a concrete implementation of obc.