Код: Выделить всё
public void scheduleOrdAggregation(){
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
String query = "mutation {\n" +
" result: scheduleOpenResourceDiscoveryAggregation(\n" +
" applicationID: $applicationId\n" +
" )\n" +
" {\n" +
" operationId\n" +
" }\n" +
"}";
Map requestBody = new HashMap();
requestBody.put("query", query);
Map variables = new HashMap();
variables.put("applicationId", "e3be7c76-9852-4f10-afc3-ca6da082e813");
requestBody.put("variables", variables);
//requestBody.put("variable_values", Collections.singletonMap("applicationId", "e3be7c76-9852-4f10-afc3-ca6da082e813"));
HttpEntity entity = new HttpEntity(requestBody, headers);
ResponseEntity response = restTemplateForUcl.postForEntity(uclEndpoint, entity, String.class);
}
Код: Выделить всё
422 Unprocessable Entity: "{"errors":[{"message":"Internal Server Error [errorID=920abef1-2ad2-4238-90b7-9552f49d428f, reason: input:3: Variable \"$applicationId\" is not defined.]","extensions":{"error":"InternalError","error_code":10}}],"data":null}"
Я еще не использую Spring Graph QL, но мне интересно, подойдет ли этот вариант?
Спасибо за информацию.
Прабал
Подробнее здесь: https://stackoverflow.com/questions/790 ... st-in-java