@Body

The {@link oaj.http.annotation.Body @Body} annotation can be applied to arguments of @RemoteMethod-annotated methods to denote that they are the HTTP body of the request.

Examples:

// Used on parameter @Remote(path="/petstore") public interface PetStore { @RemoteMethod(path="/pets") String addPet(@Body Pet pet); }

// Used on class @Remote(path="/petstore") public interface PetStore { @RemoteMethod(path="/pets") String addPet(Pet pet); } @Body public class Pet {...}

The argument can be any of the following types:

OpenAPI schema based serialization can be used by using the {@link oaj.oapi.OpenApiSerializer} class.

@RemoteMethod(path="/comma-delimited-pipe-delimited-ints") String addCommaDelimitedPipeDelimitedInts( @Body( serializer=OpenApiSerializer.class, schema=@Schema( type="array", collectionFormat="pipes", items=@Items( type="array" items=@SubItems( type="int32", // Auto-validates on client side! minimum="0", maximum="64" ) ) ) ) int[][] input );

See {@doc juneau-marshall.OpenApiDetails.Serializers} for information about supported data types in OpenAPI serialization.

If your RestClient class does not have a serializer associated with it, the body will automatically be serialized to a string using the rules defined in {@doc PojosConveribleToStrings}.