Message Boards

'/journal.journalarticle/search ' results inconsistent with java service

Tom Aerts, modified 4 Years ago.

'/journal.journalarticle/search ' results inconsistent with java service

New Member Posts: 17 Join Date: 8/25/17 Recent Posts
I'm experimenting a bit with creating a js (react) portlet, instead of the usual MVC portlets we use.
Use-case is providing the user with an overview of his created JournalArticles (of a certain structure).

To this end I intended to use the '/journal.journalarticle/search' endpoint, to get the user's created articles & then filter these results further on StructureKey.
Code i used:
Liferay.Service(
    '/journal.journalarticle/search',
    {
        groupId: Liferay.ThemeDisplay.getScopeGroupId(),
        creatorUserId: Liferay.ThemeDisplay.getUserId(),
        status: 0,
        start: 0,
                    end: 100
        },
        function(res) {
            console.log('res :', res);
        }
)


Which produces a result as follow:
Object { UID: "com.liferay.journal.model.JournalArticle_PORTLET_36347", portletId: "com.liferay.journal.model.JournalArticle" }

And I honestly have no idea what to do with this, so I tried the same in a plain java MVC portlet:
JournalArticleLocalServiceUtil.search(groupId, userId, userId, 0, 0, 10);

which produces the actual result i'd expect:
{uid=[com.liferay.journal.model.JournalArticle_PORTLET_36579], entryClassPK=[36425], companyId=[20101], entryClassName=[com.liferay.journal.model.JournalArticle], scopeGroupId=[20123], content_nl_NL=[Ik verkoop iets {"classPK":"36419","groupId":"20123","name":"oldman (1).jpg","alt":"","title":"oldman (1).jpg","type":"journal","uuid":"73e6bef4-10a5-4179-f520-e84bb5409102","fileEntryId":"36427","resourcePrimKey":"36425"} {"classPK":"36575","groupId":"20123","name":"oldlady (1).jpg","alt":"","title":"oldlady (1).jpg","type":"journal","uuid":"bb571793-85a8-859e-709e-47ad382c2476","fileEntryId":"36581","resourcePrimKey":"36425"} jef.jef@jefmail.jef], groupId=[20123], articleId=[36423], modified=[20190611083536], defaultLanguageId=[nl_NL], title_nl_NL=[Naamloos Zoekertje], version=[1.1]}

So calling the jsonws api only returns the UID and className (as 'portletId' for some reason'). Am I missing some parameters, .. from the API call or is this simply a bug?
(using curl, .. produces the same result, so I'm sure it's related to the API/the call
thumbnail
Mohammed Yasin, modified 4 Years ago.

RE: '/journal.journalarticle/search ' results inconsistent with java servic

Liferay Master Posts: 591 Join Date: 8/8/14 Recent Posts
Hi, 
You can use the id from output  com.liferay.journal.model.JournalArticle_PORTLET_36347 which is 36347 and call the below service
Liferay.Service(    '/journal.journalarticle/get-article',    {  
      id: 36347             
     },
     function(res) {   console.log('res :', res);        })​​​​​​​