I'm working with a client of a REST API specified through OpenAPI on SwaggerHub. Here I read something like this:
put:
tags:
- load
summary: adds a Demand item
operationId: addDemandItem
description: Adds a Demand item to the system
security:
- basicAuth: []
responses:
'200':
description: item correctly saved
'401':
description: 'unauthorized'
'400':
description: 'invalid input, object invalid'
parameters:
- in: path
name: partnerReferenceId
schema:
type: string
required: true
description: partnerReferenceId identifying the demand
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/DemandItem'
description: Demand item to add
The auto-generated client (jaxrs-cxf-client) has the following Java code:
@PUT
@Path(value = "/demands/{partnerReferenceId}")
@Consumes(value = {"application/json"})
@Operation(summary = "adds a Demand item", tags = {})
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "item correctly saved"),
@ApiResponse(responseCode = "400", description = "invalid input, object invalid"),
@ApiResponse(responseCode = "401", description = "unauthorized")})
public void addDemandItem(@PathParam(value = "partnerReferenceId") String string, DemandItem di);
How can I read the HTTP status of the response?
Read more here: https://stackoverflow.com/questions/65723812/how-to-read-http-status-of-the-response-in-the-jaxrs-cxf-client-generated-by-swa
Content Attribution
This content was originally published by Renato at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.