kbsali / php-redmine-api

A simple PHP Redmine API client, Object Oriented

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

homepage missing in projects

Top-CMS opened this issue · comments

Hi,

I miss the homepage when extracting all inf about the projects from Redmine, is this (base) field forgotten?

$projecten = $client->getApi('project')->all

The Redmine-API doesn't expose the project website at the /projects endpoint. To cite the documentation:

Listing projects

GET /projects.xml

Returns all projects (all public projects and private projects where user have access to)

Parameters:

  • include: fetch associated data (optional). Possible values: trackers, issue_categories, enabled_modules (since 2.6.0). Values should be separated by a comma ",".

Possible values are trackers, issue_categories, enabled_modules, so you can't include the homepage at this endpoint.

Workaround

Try the /projects/[id].xml endpoint instead:

$data = $client->getApi('project')->show($projectId);

var_dump($data['project']['homepage']); // returns 'https://homepage.example.com'

unfortunately, can't get this work

$data = $client->getApi('project')->show($projectId);

var_dump($data['project']['homepage']); 

returns Line 25 'var_dump($data['project']['homepage']); '

Warning: Illegal string offset 'project' in E:\www\redmine-api\public_html\projects.php on line 25

Warning: Illegal string offset 'homepage' in E:\www\redmine-api\public_html\projects.php on line 25
string(1) "<"

string(1) "<" string(0) "" string(0) "" string(0) "" string(0) "" string(25) "https://www.domain.nl" string(0) "" string(0) "" string(24) "https://www.domain.one" string(23)

Please check the data returned by the Redmine API and act as you need.

var_dump($data);

This is not the responsibility of this library. Thank you.