Невозможно создать заявку в Redmine с помощью API - PullRequest
0 голосов
/ 23 апреля 2019

Я работаю над Redmine API для создания и обновления билетов в PHP мне нужно перенаправить аккаунты на одном аккаунте, я могу успешно создать тикет, но на другом аккаунте я даже не получаю никаких ошибок, но даже не могу создать тикет, но на втором аккаунте, где тикет не генерируется, когда я пытался также загрузить маркер изображения не генерирует.

Я использую API https://github.com/kbsali/php-redmine-api

В обоих случаях все выглядит одинаково, тогда почему я не могу создать тикет, во второй системе, пока первый работает на первом месте, пожалуйста, посмотрите на мой код

Working and tickets creating and attachment uploading on redmine successfully

require_once 'vendor/autoload.php';
define('UPLOAD_DIR', 'uploads/');
$fileNames=uniqid() . '.png';
$img = $_POST['base64'];
$img = str_replace('data:image/png;base64,', '', $img);
$img = str_replace(' ', '+', $img);
$data = base64_decode($img);
$file = UPLOAD_DIR . $fileNames;
$success = file_put_contents($file, $data);



$client = new Redmine\Client('http://redmine.working.com', 'outlander', '857783hg');
print_r(client);
$upload = json_decode( $client->api('attachment')->upload($file) );
$client->user->all();
$client->user->listing();

$client->issue->create([
    'project_id'  => 'project-xyz',
    'subject'     => $_POST['subjectIs'],
    'description' => 'Client Name: '.$_POST['clientNames'].'==>'.$_POST['descriptionIs'],
    'assigned_to_id' => '31',
    'priority_id' => $_POST['inputPriority'],
    'uploads'     => array(
        array(
          'token'       => $upload->upload->token,
          'filename'    => $file,
          'description' => 'This is my file description',
          'content_type'=> 'image/png'
        )
    )
]);

client print data 

Redmine\Client Object
(
    [port:Redmine\Client:private] => 80
    [url:Redmine\Client:private] => http://redmine.abc.com
    [apikeyOrUsername:Redmine\Client:private] => outlander
    [pass:Redmine\Client:private] => 857783hg
    [checkSslCertificate:Redmine\Client:private] => 
    [checkSslHost:Redmine\Client:private] => 
    [sslVersion:Redmine\Client:private] => 0
    [useHttpAuth:Redmine\Client:private] => 1
    [apis:Redmine\Client:private] => Array
        (
        )

    [impersonateUser:protected] => 
    [customHost:protected] => 
    [responseCode:Redmine\Client:private] => 
    [curlOptions:Redmine\Client:private] => Array
        (
        )

    [classes:Redmine\Client:private] => Array
        (
            [attachment] => Attachment
            [group] => Group
            [custom_fields] => CustomField
            [issue] => Issue
            [issue_category] => IssueCategory
            [issue_priority] => IssuePriority
            [issue_relation] => IssueRelation
            [issue_status] => IssueStatus
            [membership] => Membership
            [news] => News
            [project] => Project
            [query] => Query
            [role] => Role
            [time_entry] => TimeEntry
            [time_entry_activity] => TimeEntryActivity
            [tracker] => Tracker
            [user] => User
            [version] => Version
            [wiki] => Wiki
            [search] => Search
        )

)

Не работает и заявки не создаются, а загрузка вложений не создает токен. Пустой ответ

require_once 'vendor/autoload.php';
define('UPLOAD_DIR', 'uploads/');
$fileNames=uniqid() . '.png';
$img = $_POST['base64'];
$img = str_replace('data:image/png;base64,', '', $img);
$img = str_replace(' ', '+', $img);
$data = base64_decode($img);
$file = UPLOAD_DIR . $fileNames;
$success = file_put_contents($file, $data);



$client = new Redmine\Client('http://redmine.notworking.com', 'nwoutlout', 'K!3.sFAA5;=3');
print_r(client);
$upload = json_decode( $client->api('attachment')->upload($file) );
$client->user->all();
$client->user->listing();

$client->issue->create([
    'project_id'  => 'project-xyz',
    'subject'     => $_POST['subjectIs'],
    'description' => 'Client Name: '.$_POST['clientNames'].'==>'.$_POST['descriptionIs'],
    'assigned_to_id' => '31',
    'priority_id' => $_POST['inputPriority'],
    'uploads'     => array(
        array(
          'token'       => $upload->upload->token,
          'filename'    => $file,
          'description' => 'This is my file description',
          'content_type'=> 'image/png'
        )
    )
]);


Client print data of url not working

Redmine\Client Object
(
    [port:Redmine\Client:private] => 80
    [url:Redmine\Client:private] => http://redmine.notworking.com
    [apikeyOrUsername:Redmine\Client:private] => nwoutlout
    [pass:Redmine\Client:private] => K!3.sFAA5;=3
    [checkSslCertificate:Redmine\Client:private] => 
    [checkSslHost:Redmine\Client:private] => 
    [sslVersion:Redmine\Client:private] => 0
    [useHttpAuth:Redmine\Client:private] => 1
    [apis:Redmine\Client:private] => Array
        (
        )

    [impersonateUser:protected] => 
    [customHost:protected] => 
    [responseCode:Redmine\Client:private] => 
    [curlOptions:Redmine\Client:private] => Array
        (
        )

    [classes:Redmine\Client:private] => Array
        (
            [attachment] => Attachment
            [group] => Group
            [custom_fields] => CustomField
            [issue] => Issue
            [issue_category] => IssueCategory
            [issue_priority] => IssuePriority
            [issue_relation] => IssueRelation
            [issue_status] => IssueStatus
            [membership] => Membership
            [news] => News
            [project] => Project
            [query] => Query
            [role] => Role
            [time_entry] => TimeEntry
            [time_entry_activity] => TimeEntryActivity
            [tracker] => Tracker
            [user] => User
            [version] => Version
            [wiki] => Wiki
            [search] => Search
        )

)

Я использую API https://github.com/kbsali/php-redmine-api

В обоих случаях все выглядит одинаково, поэтому я не могу создать тикет во второй системе, пока первый работает на первом месте,

...