Annotation Type ApiAction


@Target(METHOD) @Retention(RUNTIME) public @interface ApiAction
Registers an action with the API framework. This is then surfaced to callers. The list of parameters to the method is converted into HTTP style parameters. This is only processed if the Class also has an ApiModel annotation. An action method can return either void (and use default response settings) or an ApiResponse instance to provide custom data to be used in the response.
See Also:
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    Specifies that this action is the default action for the specified HTTP method.
    The HTTP Method to bind this action to.
    A name for this action, which will be generated from the method name.
    Allows specifying an alternate resource path to be used when constructing the HREF for the action.
    Title of the Action, this is used in the Siren serialization and likely later surfaced as documentation.
    The Content Type expected for the HTTP Request that triggers the action.
  • Element Details

    • method

      String method
      The HTTP Method to bind this action to.
      Returns:
      HTTP Method to Bind to
      Default:
      "POST"
    • name

      String name
      A name for this action, which will be generated from the method name. For POST or PUT methods this will be passed as an ":operation" parameter like Sling operations. This parameter will be stripped before invoking the target action.
      Returns:
      name of the Action
      Default:
      ""
    • title

      String title
      Title of the Action, this is used in the Siren serialization and likely later surfaced as documentation.
      Returns:
      the title of the Action
      Default:
      ""
    • type

      String type
      The Content Type expected for the HTTP Request that triggers the action.
      Returns:
      The content type of the request
      Default:
      ""
    • isDefault

      boolean isDefault
      Specifies that this action is the default action for the specified HTTP method. When a request comes in to the resource and the framework cannot match an exact action for it it will be passed into this action. Only one default action is allowed per HTTP method, and none are required to be registered. Default actions are not serialized into the outputted JSON on a get.
      Returns:
      Whether or not this is the default action for the specified HTTP method
      Default:
      false
    • resourcePath

      String resourcePath
      Allows specifying an alternate resource path to be used when constructing the HREF for the action. By default, the path of the current resource is used. This can be used to reference actions that are available at a specific URL instead of being available from the current resource.
      Returns:
      The resource path to use when constructing the HREF.
      Default:
      ""