I am working on an extension and I want a particular API endpoint structure. I'm trying to have this structure:

enter image description here

Based on the documentation here, having entities created as direct children to the v3 or v4 directory and creating CRUD operations on those is pretty straight forward and you get most of the work done for you using civix:

enter image description here

Question: Is there a way to create nested entities and api endpoints so that I can create the api structure in the first image?

When I created the Certification entity, the generated files shown in the second image support top level CRUD functionality (Ex: Certification -> Create), but not (Ex: Certification -> Math -> Skill -> Create). This is probably because of the generated BAO and DAO classes being like CRM_Certification_BAO_Certification and the base element in Certification.xml being CRM/Certification. I am sure there are other conflicts too that I am missing.

So far I have tried this code for my Read.php endpoint under the Certification->Math->CompletedSkill path:

enter image description here

The code does not execute / API not called

Note: As I mentioned above, I can get the API call to work if I make a file directly under Certification and call it something like Getmathcompletedskills.php and change the code to:

![enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.