Symptom
How to support MultiValueMap<String, String> as the RequestParam for the method endpoint and input parameter of type application/x-www-form-urlencoded (HTML Form) with Open API 3 Annotations in SAP Commerce Cloud 2211.
In Spring Framework, that HTTP content type header is represented by constant MediaType.APPLICATION_FORM_URLENCODED_VALUE.
In this example, the API below working in SAP Commerce Cloud 2105:
@RequestMapping(
value = "/token",
method = RequestMethod.POST,
consumes = { MediaType.APPLICATION_FORM_URLENCODED_VALUE }
)
@ResponseBody
@ApiOperation(
value = "Gets oauth access token.",
notes = "Gets oauth access token."
)
@ApiImplicitParams(
{
@ApiImplicitParam(
name = "grant_type",
value = "grant type",
required = true,
dataType = "string",
paramType = "form"
),
@ApiImplicitParam(
name = "client_secret",
value = "client secret.",
required = true,
dataType = "string",
paramType = "form"
),
@ApiImplicitParam(
name = "client_id",
value = "client id.",
required = true,
dataType = "string",
paramType = "form"
),
@ApiImplicitParam(
name = "username",
value = "username.",
required = true,
dataType = "string",
paramType = "form"
),
@ApiImplicitParam(
name = "password",
value = "password.",
required = true,
dataType = "string",
paramType = "form"
)
}
)
@ApiBaseSiteIdParam
public ResponseEntity<OAuth2AccessTokenWsDTO> punchoutLevel2Auth(
@ApiParam(hidden = true)
@RequestParam final MultiValueMap<String, String> parameters
) throws HttpRequestMethodNotSupportedException {
...
}
Read more...
Environment
SAP Commerce Cloud 2211
Product
SAP Commerce Cloud 2211
Keywords
commerce, cloud, ccv2, swagger, form, x-www-form-urlencoded, APPLICATION_FORM_URLENCODED_VALUE, consumes, WsRequestDTO, DTO , KBA , CEC-SCC-COM-BBA-PUN , Punchout , CEC-SCC-COM-BC-OCC , Commerce Web Services - OCC , How To
About this page
This is a preview of a SAP Knowledge Base Article. Click more to access the full version on SAP for Me (Login required).Search for additional results
Visit SAP Support Portal's SAP Notes and KBA Search.
SAP Knowledge Base Article - Preview