Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: Is there any rest api to retrieve Related Assets for a particular artic
I'd like to use rest api to fetch the article as well as Related Assets for that particular article.
For retrieving article, I am able to find rest api like below to get the article.
http://localhost:8080/api/jsonws/journalarticle/get-article/group-id/21290/article-id/21310
However, I also want to retrieve the Related Assets for this particular article. Is there any rest api can do this?
For retrieving article, I am able to find rest api like below to get the article.
http://localhost:8080/api/jsonws/journalarticle/get-article/group-id/21290/article-id/21310
However, I also want to retrieve the Related Assets for this particular article. Is there any rest api can do this?
I think to do this you need to use the AssetEntry portion of the JSON API with a classNameId referencing the JournalArticle and a classPK being the ID for the article with the related assets you want to retrieve.
Andrew Jardine:
I think to do this you need to use the AssetEntry portion of the JSON API with a classNameId referencing the JournalArticle and a classPK being the ID for the article with the related assets you want to retrieve.
Thanks for the reply. I tried to look at the AssetEntry portion of the JSON API , but the only api require classNameId and classPK is /assetentry/increment-view-counter , I don't think this one is able to retrieve Related Assets. I noticed there is api /assetentry/get-entries , this one looks like can be used to return what I want. However, the input parameter is com.liferay.portlet.asset.service.persistence.AssetEntryQuery , and it returns java.util.List. I am not sure how to pass AssetEntryQuery to the rest api and get the results. Is there any sample code I can take a reference?
Below is sample data return by http://localhost:8080/api/jsonws/journalarticle/get-article/group-id/21290/article-id/21310, from the output, what should I use to build the AssetEntryQuery ?
{
"articleId": "21310",
"classNameId": 0,
"classPK": 0,
"companyId": 20155,
"content": "",
"createDate": 1457924968000,
"description": "",
"descriptionCurrentValue": "",
"displayDate": 1457414820000,
"expirationDate": null,
"folderId": 0,
"groupId": 21290,
"id": 21951,
"indexable": true,
"layoutUuid": "",
"modifiedDate": 1457938208000,
"resourcePrimKey": 21312,
"reviewDate": null,
"smallImage": false,
"smallImageId": 0,
"smallImageURL": "",
"status": 0,
"statusByUserId": 20434,
"statusByUserName": "Test Test",
"statusDate": 1457938208000,
"structureId": "21305",
"templateId": "21307",
"title": "",
"titleCurrentValue": "Seagate To Participate In Investor Event",
"treePath": "/0/",
"type": "general",
"urlTitle": "seagate-to-participate-in-investor-event",
"userId": 20434,
"userName": "Test Test",
"uuid": "9a2f4f42-abe3-40b2-a1a4-77d91481ff92",
"version": 2
}
The classNameId you can get by using /api/jsonws?signature=%2Fclassname%2Ffetch-class-name-id-1-clazz .. where the name of the java class the java class that is it associated with. If you run this query against your database:
But I see now what you mean in that there doesn't appear to be an (obvious) endpoint for retrieving the asset entries that are associated to a Journal Article. We have a separate thread (https://www.liferay.com/community/forums/-/message_boards/message/71461488) going as well which I think is for another question you posted as part of the same problem you are trying to solve so perhaps we can park this for the moment.
SELECT * FROM ClassName_ where value like '%Journal%';
But I see now what you mean in that there doesn't appear to be an (obvious) endpoint for retrieving the asset entries that are associated to a Journal Article. We have a separate thread (https://www.liferay.com/community/forums/-/message_boards/message/71461488) going as well which I think is for another question you posted as part of the same problem you are trying to solve so perhaps we can park this for the moment.
Are there any ADT examples of getting related assets from an asset publisher (set to documents?). So a document has a related document to it but I can't find documentation on how to code a template to display a related asset??
This is wonderful here ...
https://github.com/jordanamorais/lfrgs-frontend-samples/tree/master/adts
But not finding the code to drag out related assets?
This is wonderful here ...
https://github.com/jordanamorais/lfrgs-frontend-samples/tree/master/adts
But not finding the code to drag out related assets?
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™