Content Management and Capture

 View Only

 Accessing Content Engine GenAI API's using GraphQL

John Bourdeau's profile image
John Bourdeau posted Mon June 30, 2025 04:49 PM

I'm trying to use GraphQL to query content engine's GenAPI's.  I'm using the example found at Content Engine GraphQL API sample mutations and queries.

When I run the query I'm getting an error:

[6/30/25 16:36:42:592 EDT] 000000b6 ContentServic E   Exception while fetching data (/createCmAbstractPersistable) : com.filenet.apiimpl.core.DocumentImpl incompatible with com.filenet.apiimpl.core.CmAbstractPersistableImpl
                                 java.lang.ClassCastException: com.filenet.apiimpl.core.DocumentImpl incompatible with com.filenet.apiimpl.core.CmAbstractPersistableImpl

Ayone understand the error?

Does anyone have an example query for GenAI (Content Assistant)?

JANE Luo's profile image
JANE Luo

Are you creating a base query? vector query? document query? Could you past your creation of query?

DAVID Hanson's profile image
DAVID Hanson

The error suggests the className variable being passed to the graphql mutation, as in the example mutations and queries, is a Document class rather than a CmAbstractPersistable sub-class. The className should be a class as in the examples such as "className": "GenAIBaseQuery". What className are you using?

John Bourdeau's profile image
John Bourdeau

thank you Jane and David for the response and help.  Yes, the error was on my end passing the classname.  I was not passing one of the GenAI classes. 

Is there anyway to control the FileNet class that is being acted upon? The exmple would be to perform a vector query but I want to define the filenet class.  Currently I find all of the documents in the class then pass them to the multidocument query.  I want to skip the first step.