Вот код, который я использую:
Код: Выделить всё
CloseableHttpClient httpClient = HttpClients.createDefault();
HttpPost postRequest = new HttpPost(UPLOAD_URL);
postRequest.setHeader("Authorization", "Bearer " + token);
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
builder.addBinaryBody("results", new FileInputStream(cucumberReport), ContentType.APPLICATION_OCTET_STREAM, cucumberReport.getName());
builder.addTextBody("info", testExecutionJson, ContentType.TEXT_PLAIN);
HttpEntity entity = builder.build();
postRequest.setEntity(entity);
HttpResponse response = httpClient.execute(postRequest);
Авторизация прошла успешно, я получаю токен в ответ на предыдущий запрос.
Отправляю следующие данные TestExecution:
Код: Выделить всё
{
"fields": {
"summary": "Upload Test",
"issuetype": {
"id": "10302"
},
"customfield_13906": "ENV1",
"project": {
"id": "21901"
}
},
"xrayFields": {
"environments": ["ENV1"],
"testPlanKey": "IT-110958"
}
}
Код: Выделить всё
ERROR: The request could not be satisfied
503 ERROR
The request could not be satisfied.
The Lambda function associated with the CloudFront distribution is invalid or doesn't have the required permissions.
We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.
If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.
Generated by cloudfront (CloudFront)
Request ID: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Подробнее здесь: https://stackoverflow.com/questions/789 ... xray-cloud