Message Boards

Does Liferay DXP 7.2 has GraphQL support?

Gwowen Fu, modified 4 Years ago.

Does Liferay DXP 7.2 has GraphQL support?

New Member Posts: 12 Join Date: 11/5/19 Recent Posts
Hi, Does Liferay DXP 7.2 has out of box GraphQL support like REST APIs?
Thank you! 
thumbnail
Jack Bakker, modified 4 Years ago.

RE: Does Liferay DXP 7.2 has GraphQL support?

Liferay Master Posts: 978 Join Date: 1/3/10 Recent Posts
In Liferay's slack I was told support for GraphQL is available in 7.2 SP1 and 7.1 FP12 onwards, will be released in 7.2 GA2. But I don't work for Liferay so can't confirm this emoticon
Gwowen Fu, modified 4 Years ago.

RE: Does Liferay DXP 7.2 has GraphQL support?

New Member Posts: 12 Join Date: 11/5/19 Recent Posts
Thanks! This page, https://www.liferay.com/solutions/headless-apis,  says GraphQL is supported, but I was not able to find any documentation at all.
thumbnail
David H Nebinger, modified 4 Years ago.

RE: Does Liferay DXP 7.2 has GraphQL support?

Liferay Legend Posts: 14919 Join Date: 9/2/06 Recent Posts
Documentation is being worked on Gwowen, not sure though of ETA.
thumbnail
Jack Bakker, modified 4 Years ago.

RE: Does Liferay DXP 7.2 has GraphQL support?

Liferay Master Posts: 978 Join Date: 1/3/10 Recent Posts
I have also heard GraphQL support in Liferay is still a work in progress. I have a project with a golang server app handling the GraphQL api from a frontend PWA (lit-html, lit-apollo) where in turn the golang app interfaces with the new headless api . For the golang code (consuming the Liferay REST apis) I used the openapi-generator: which can generate code for many languages and supports openapi3. On my radar for the future is looking at the GraphQL in Liferay itself, but have not dove into it yet. 
thumbnail
Denis Signoretto, modified 4 Years ago.

RE: Does Liferay DXP 7.2 has GraphQL support?

Expert Posts: 375 Join Date: 4/21/09 Recent Posts
Hi Gwowen,
as announced here, https://liferay.dev/blogs/-/blogs/liferay-portal-7-2-ce-ga2-release
Liferay GraphQL support has been added to Liferay 7.2 CE GA2 (recently released) and to 7.2 DXP SP1.
thumbnail
Andre Kreienbring, modified 4 Years ago.

RE: Does Liferay DXP 7.2 has GraphQL support?

Regular Member Posts: 152 Join Date: 12/18/06 Recent Posts
I have a Liferay 7.2 CE GA2  up and running but
The URL
http://localhost:8080/o/graphql
like documented here
https://portal.liferay.dev/docs/7-2/frameworks/-/knowledge_base/f/get-started-discover-the-api
returns nothing
thumbnail
Andre Kreienbring, modified 4 Years ago.

RE: Does Liferay DXP 7.2 has GraphQL support?

Regular Member Posts: 152 Join Date: 12/18/06 Recent Posts
Sorry I was wrong:
Using Altair, a GraphQL Client extension of Firefox and sending a query works fine:
query {
  messageBoardThreads(siteKey: "Guest") {
    items {
      aggregateRating {
        ratingCount
        ratingValue
      }
      articleBody
      id
      messageBoardMessages {
        items {
          headline
        }
      }
    }
    page
    pageSize
    totalCount
  }
}
thumbnail
Jack Bakker, modified 4 Years ago.

RE: Does Liferay DXP 7.2 has GraphQL support?

Liferay Master Posts: 978 Join Date: 1/3/10 Recent Posts
Hey Andre, that moment of success is exciting.  
thumbnail
Fernando Fernandez, modified 4 Years ago.

RE: Does Liferay DXP 7.2 has GraphQL support?

Expert Posts: 396 Join Date: 8/22/07 Recent Posts
Are you able to do queries that require authentication with Altair? I still don't  know how you authenticate  the requests... I read that you can add a Basic auth header but I couldn't make it work up to now (working with curl, though).

Fernando 
thumbnail
ANKIT SRIVASTAVA, modified 4 Years ago.

RE: Does Liferay DXP 7.2 has GraphQL support?

Junior Member Posts: 76 Join Date: 2/2/11 Recent Posts
You can add header "AUTHORIZATION" as  "Basic dGVzdEBsaWZlcmF5LmNvbTp0ZXN0"  where I have provided Base64 encoding for "test@liferay.com:test". You need to change it as per your setup.
thumbnail
Fernando Fernandez, modified 4 Years ago.

RE: Does Liferay DXP 7.2 has GraphQL support?

Expert Posts: 396 Join Date: 8/22/07 Recent Posts
Yup. Somehow I messed up the base64 in my previous atempt. It works now. :-)
thumbnail
ANKIT SRIVASTAVA, modified 4 Years ago.

RE: Does Liferay DXP 7.2 has GraphQL support?

Junior Member Posts: 76 Join Date: 2/2/11 Recent Posts
https://liferay.dev/blogs/-/blogs/new-graphql-apis-in-liferay-7-2
RestBuilder tool in DXP 7.2 creates the Rest Services with OpenAPI and GraphQL support.