Layer7 API Management

Expand all | Collapse all

Custom endpoints vs. Resources

Jump to Best Answer
  • 1.  Custom endpoints vs. Resources

    Posted 10-24-2017 06:13 AM

    If we are writing the Javascript code and want to expose that as API, which is the best choice to proceed Custom endpoint or resource? I know there are some limitations of one on the other like some standard things like row is accessible in resource where it is not in the custom endpoint. 


    I want to know the best practice from CA. Please give your thoughts. Thanks in advance.

  • 2.  Re: Custom endpoints vs. Resources
    Best Answer

    Posted 11-01-2017 05:37 PM

    Generally speaking, JavaScript resources are meant to return data, for instance from a non-standard data source, whereas custom endpoints are meant to return other things, like binary data, HTML, or whatever.


    JS resources are always authenticated, whereas custom endpoints don't have to be.


    JS resources must return JSON, whereas custom endpoints can return anything.


    JS resources can be attached to a parent resource, thereby enabling you to perform a join from a standard data source to a non-standard data source (like an LDAP directory, for instance). Custom endpoints are always top-level, and their URL differs from resources because they contain "http" instead of "rest".


    If this is not enough, perhaps you could describe your specific use case, and we could discuss what makes sense for you?