Youtrack API file
I am developing a web interface for viewing issue from youtrack on my web-portal. Question. if I can get the file attached to the API? No link, the binnary file. Thank you
I do not want to give access my visitors to youtrack. Only ip web server has access to api youtrack. Thanks
I do not want to give access my visitors to youtrack. Only ip web server has access to api youtrack. Thanks
Please sign in to leave a comment.
Yes, with the command it's possible.
Thank you.
Thanks for the answer. But I want to download an attachment from youtrack and not upload it.
Thank you for clarification.
Then did you try Get attachments method? This URL can be used on your issue form. Otherwise, please specify the case in more details.
Thank you.
//in my php
$file = htmlspecialchars($_GET['name']);
$fileid = htmlspecialchars($_GET['id']);
$issue = $youtrack->getAttachmentContent("http://xx.xx.xx.xx:8080/_persistent/$file?file=$fileid");
$header = $issue["type"];
$content = $issue["content"];
header("Content-Type: $header");
header("Content-disposition: filename='$file'");
echo $content;
// functions in class
public function getAttachmentContent($url)
..........
$result = $this->request('GET', $url);
......
return array(
'content' => $result['content'],
'type' => $result['response']['content_type'],
);
protected function request($method, $url)
....
switch ($method) {
case 'GET':
curl_setopt($this->http, CURLOPT_HTTPGET, true);
break;
case 'PUT':
......
$content = curl_exec($this->http);
$response = curl_getinfo($this->http);
......
return array(
'content' => $content,
'response' => $response,
);