2

While writing RESTful API calls, I got some urls which takes multiple path parameters. e.g. www.mydomain.com/exam/{examId}/subject/{subjectId}/section/{sectionId}/questions Now, If I use any JAX-RS implementation (like Apache Wink) It is quite simple to get path parameters [ using @PathParam].

Do we have simple way to handle such calls in moqui?

Also, I checked <resource name="SomeName">...</resource>, but In first look I find it complex and not sure with relevancy and limitations also.

1 Answers1

0

With the reference to the resource element it looks like you are using the Service REST API feature in Moqui with an XML file.

For multiple path parameters separated by constants you would just use nested resource and id elements. There is an example of this in mantle.rest.xml for a path like:

/rest/s1/mantle/parties/{partyId}/contactMechs/{contactMechId}

The resource and id nodes from that look like:

<resource name="parties">
    <id name="partyId">
        <resource name="contactMechs">
            <id name="contactMechId">
                ...
            </id>
        </resource>
    </id>
</resource>

When you have multiple named id elements in a relevant path there will be a context field for each name with the value from the path and that will be passed to the internal service call, or used for the entity operation, along with any other query string or body parameters.

David E. Jones
  • 1,721
  • 1
  • 9
  • 8