public void executePostApiWithParametersAndExpectSuccess()

in src/main/java/platform/qa/steps/RestApiStepDefinitions.java [242:276]


    public void executePostApiWithParametersAndExpectSuccess(String userName,
                                                             @NonNull String path,
                                                             @NonNull Map<String, String> queryParams) {
        var context = convertToRequestsContext(testContext.getScenarioContext().getContext(API_RESULTS));
        Map<String, Object> paramsWithIds = getBodyWithIds(queryParams, context);

        if (hasCurlyBracketsInQueryParameters(paramsWithIds)) {
            log.info("parameters and ids don't match, POST request couldn't be send", path);
            return;
        }

        String signature = new SignatureSteps(registryConfig.getDataFactory(userName),
                registryConfig.getDigitalSignatureOps(userName),
                registryConfig.getRedis()).signRequest(paramsWithIds);

        String payload = new ObjectMapper().writeValueAsString(paramsWithIds);

        var response = new RestApiClient(registryConfig.getDataFactory(userName), signature)
                .post(payload, path)
                .then()
                .statusCode(is(both(greaterThanOrEqualTo(HttpStatus.SC_OK))
                        .and(lessThanOrEqualTo(HttpStatus.SC_MULTI_STATUS))))
                .extract()
                .response();

        var result = response
                .jsonPath()
                .getMap("");

        var updatedResult = getResultKeyConvertedToCamelCase(path, new HashMap<>(result));
        var request = new Request(path, queryParams, singletonList(updatedResult), new Timestamp(currentTimeMillis()));
        context.add(request);

        testContext.getScenarioContext().setContext(API_RESULTS, context);
    }