Search code examples
restapimule-studiomulesoft

Providing a basepath for a HTTP method


Say, Im developing an reusable / extensible API and willing to provide http://<host>/XX/V1.0 as URL endpoint for clients to do POST.This works fine. Can I add a resource(/events) for another POST/GET like http://<host>/XX/V1.0/events.? What will happen to my original POST? Is this approach right? Shouldn't we use our baseurl for any method invocations? What is the best way to implement an API definition here?


Solution

  • In your example your base URL is http:///XX/V1.0. It is OK to have different resource with different -or same- HTTP verbs. The implementation, for example APIKit, should be able to distinguish between the different URIs.

    What I don't understand is why you are using the base URL as a resource. That seems to go against a REST design. My understanding is that the base URL should be used as the base for the resources URIs, and not as a resource itself.