@Post(value = "/requires-body", consumes = MediaType.APPLICATION_JSON) String requiresBody(Integer max) { return "Body Value: " + (max != null ? max : "null"); }
@Post(value = "/nullable-body", consumes = MediaType.APPLICATION_JSON) String nullableBody(@Nullable Integer max) { return "Body Value: " + (max != null ? max : "null"); }
/** * Registers a new {@link InstanceInfo} with the Eureka server. * * @param appId The application id * @param instance The instance * @return A status of {@link io.micronaut.http.HttpStatus#NO_CONTENT} on success */ @Post(uri = "/apps/{appId}", single = true) @Retryable( attempts = AbstractEurekaClient.EXPR_EUREKA_REGISTRATION_RETRY_COUNT, delay = AbstractEurekaClient.EXPR_EUREKA_REGISTRATION_RETRY_DELAY ) Publisher<HttpStatus> register(@NotBlank String appId, @Valid @NotNull @Body InstanceInfo instance);
@Post Single<Pet> save(@NotBlank String name, @Min(1L) int age); // end::save[]
@Post(value = "/book/{title}", consumes = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED}) @Status(HttpStatus.CREATED) Book save(String title) { return new Book(title); } }
@Post("/greet") @Status(HttpStatus.CREATED) Message echo(@Body Message message) { return message; }
@Post(value = "/hello", consumes = MediaType.TEXT_PLAIN, produces = MediaType.TEXT_PLAIN) @Status(HttpStatus.CREATED) String echoHello(@Body String message) { return message; }
@Post(value = "/book", consumes = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED}) @Status(HttpStatus.CREATED) Book save(@Body Book book) { return book; } }
@Post("/") Single<Vendor> save(String name); }
@Post("/calculate") CalculatePriceResult calculatePrice(@Body @NotNull CalculatePriceCommand cmd); }
@Post("/{name}") HttpStatus saveFeature(String name, FeaturesEndpoint.Feature feature); }
@Post("/send") HttpResponse send(@Valid @Body Email email); }
@Post("/") Single<T> save(@Valid @Body T pet); }
@Post("/send") public HttpResponse send(@Valid @Body Email email) { log.info(email.toString()); if ( emailService == null ) { log.warn("Email service not injected"); return HttpResponse.serverError(); } emailService.send(email); return HttpResponse.ok(); } }
/** * Add a new comment under a given topic * @param topic The topic * @param poster The poster * @param content The content * @return An {@link HttpStatus#CREATED} if the comment was created */ @Post("/{topic}/comments") HttpStatus add( @NotBlank String topic, @NotBlank String poster, @NotBlank String content);
/** * Add a new comment under a given topic * @param id The id of the comment * @param poster The poster * @param content The content * @return An {@link HttpStatus#CREATED} if the comment was created */ @Post("/comment/{id}/reply") HttpStatus addReply( @NotBlank Long id, @NotBlank String poster, @NotBlank String content); }