Hi there! I am working on implementing this package in our app. I am able to make GET requests successfully; however, when making POST requests, I am consistently getting HTTP 415 Unsupported Media Type
returned. I initially tried implementing the POST request example from the documentation, but got a 404. I have tried this with a number of Guzzle params, including setting Accept-Content and Content-Type, but continually get this error.
$params = [
'project' => [
'key' => $this->settings['project'],
],
'summary' => $item->title,
'description' => $item->body,
"issuetype" => [
"name" => "Bug"
],
];
$options = [
'debug' => true,
];
$psrHttpClient = new Guzzle([
'base_uri' => $this->settings['host'],
]);
// Instantiate YouTrack API HTTP Client Adapter
$httpClient = new YouTrackClient($psrHttpClient);
// Instantiate YouTrack API Token Authorizer
$authorizer = new YouTrackAuthorizer($this->settings['token']);
try {
$this->connection = new YoutrackConnection($httpClient, $authorizer, 'youtrack/api');
$response = $this->connection->post(
'/issues',
$params,
$options
);
$output = $response->toArray();
$this->output = $output;
} catch (\Exception $e) {
$this->error = [
'code' => $e->getCode(),
'reason' => $e->getMessage(),
'error' => $e->getPrevious(),
// 'body' => $e->getResponseBody(),
];
return $this->error();
}
'code' => 415,
'reason' => '{"error":"Unsupported Media Type","error_description":"HTTP 415 Unsupported Media Type"}',
I am able to make the same call via Postman and it is successful.