Help creating a document with API

Hi. I’m trying to make a custom API for creating documents. I’m following the example in the document, but getting ClassCastException with the wpm.createObject() method.

                String beanPath = wpm.createAndReturn(
                        path, 
                        "cm:EventDocument", 
                        name,
                        true);
///
HippoDocument hippoDocument = (HippoDocument) wpm.getObject(beanPath); //works
EventDocument eventDocumentBean = (EventDocument) wpm.getObject(beanPath); //doesn't work
java.lang.ClassCastException: class org.hippoecm.hst.content.beans.standard.HippoDocument$EventDocument$4vkQoxwy cannot be cast to class org.sae.cm.modules.document.EventDocument (org.hippoecm.hst.content.beans.standard.HippoDocument$EventDocument$4vkQoxwy and org.sae.cm.modules.document.EventDocument are in unnamed module of loader org.apache.catalina.loader.ParallelWebappClassLoader @3bb44eac)

Any ideas?

Thank you.

Hi @Joshua_Glickman ,

You can check here some of the useful Development tools that might help you. Let us know if this helps. Development Tools - Bloomreach Experience Manager (PaaS/Self-Hosted) - The Fast and Flexible Headless CMS