UI/UX

GraphQL in Liferay DXP

GraphQL in Liferay DXP

 

Checkout the flow diagram here 

What is GraphQL ?

GraphQL is basically a query language to read or mutate data in API . In simple words its a way to call API for read and write purpose using query like syntax . Using GraphQL feels like you are querying an API service instead of a database . This was developed by Facebook .

Challenges with REST

REST API calls has lot of advantages which is well known to developers but at the same time there are few drawbacks which REST API calls doesn’t address . Lets talk about few of them

Over fetching: This is when the API endpoint provides way more information than required by the client.

Under fetching: This is when the API endpoint doesn’t provide all of the required information. So, the client has to make multiple requests (API Calls) to get everything the application needs.

When to use GraphQL ?

 

Architectural Scenarios

  • While writing code for mobile devices, smartwatches, and IOT Platforms , where bandwidth usage is critical parameter.
  • Application requirements where nested data needs to be fetched in a single call ( For example a case when we need USER details then PRODUCTS details bought by USER ).
  • A composite pattern, where an application retrieves data from multiple, different storage APIs.

 

How to use GraphQL in Liferay ?

Liferay by default comes with Out of the box List of APIs which you can access

  1. First Login as Admin
  2. Use the same browser to call the following URL
http://[host]:[port]/o/api

For example, if you’re running Liferay DXP locally on port 8080, the URL for discovering the GraphQL API is

3) Once you are on this page you can click GraphQL link on the top Right of the page

Example to Read

Here are steps to read all the blog content through GraphQL API

  1. Login as Admin
  2. Hit the URL http://localhost:8080/o/api
  3. Go to Graphql Tab
  4. write the Following query

query

{

blogPostings(filter:””,page:1,pageSize:10,search:””,siteKey:”47311″,sort:””)

{

page

items

{

id

headline

creator

{

name

}

}

}

}

Get the siteKey from Site configuration page of the site as shown in the Image 3 and replace in your query. If you have any blogs in that site then the query will give back some results else you can do the next step (To enter a blog entry via API) First and then retry this query again to get back some results . In my case since I had an entry you can see the API output on the Right hand side in the screenshot .

Image 1

Image 2

Example to Mutate (Write)

Here are steps to read all the blog content through GraphQL API

  1. Login as Admin
  2. Hit the URL http://localhost:8080/o/api
  3. Go to Graphql Tab
  4. write the Following query

mutation CreateBlog($blog: InputBlogPosting)

{

createSiteBlogPosting(blogPosting: $blog, siteKey: “47311” )

{

headline

articleBody

id

friendlyUrlPath

}

}

}

In the Query Variables you can enter the entry like following

{

“blog”:

{

“articleBody”: “Contact us for EU based Liferay Consultants at Liferayconsulting.com !”,

“headline”: “Liferayconsulting.com”

}

}

now run the query and the API call to write or mutate is done . You can now rerun the read query to find your entry appearing there .

Diagram Links

GraphQL in Liferay DXP Read More »

Comparison between Liferay DXP and Adobe Experience Manager

Comparison between Liferay DXP and Adobe Experience Manager

Liferay DXP and Adobe Experience Manager (AEM) are two of the market’s most prominent digital experience platforms. Both offer comprehensive solutions for creating and managing digital experiences for enterprises. We will compare Liferay DXP with AEM in this article to help you determine which platform is best for your company.

 

The User Interface

A platform’s user interface is critical in determining its usability and user-friendliness. Liferay DXP has an easy-to-use user interface that allows users to create, manage, and publish information. The platform offers an easy-to-use dashboard that displays an overview of all operations and procedures.

 

AEM, on the other hand, has a more complicated user interface that takes time to learn and master. However, once you get used to it, the platform offers a rich set of capabilities and functionalities that Liferay DXP does not.

 

Content Administration

The backbone of any digital experience platform is content management. Liferay DXP is a great content management system that allows users to easily create, update, and manage material. The platform also includes versioning and workflow management solutions, allowing firms to properly manage their material.

AEM, on the other hand, provides a feature-rich and highly scalable advanced content management system. Users can access a centralised repository for all of their digital assets, such as films, photographs, and documents, through the platform. AEM also has a powerful set of workflow management features to help firms manage their content more effectively.

 

Personalization

Personalization is an important aspect of every digital experience platform. Liferay DXP gives users a simple and basic personalization solution for creating personalized experiences for their clients. Businesses can use the platform to segment their audiences based on demographics, behavior, and interests.

 

AEM, on the other hand, offers a more advanced personalization tool that employs machine learning algorithms to provide clients with a highly personalized experience. Businesses can use the platform to create tailored content based on their customers’ behavior, interests, and preferences.

 

Integration

Integration is another critical thing to consider when selecting a digital experience platform. Liferay DXP integrates seamlessly with third-party apps, allowing organizations to design customized solutions that match their specific requirements. The platform also has APIs that allow developers to easily integrate their apps with Liferay DXP.

 

AEM, on the other hand, has advanced integration features that enable enterprises to interact with a wide range of systems and applications. The platform has a flexible architecture that allows developers to quickly construct custom integrations.

 

Comparison between Liferay DXP and Adobe Experience Manager Read More »

Language
Scroll to Top