API Wrapper - Creating new comments, user is not the correct one.

This topic is archived because there were no new posts for more than 12 months. The historical information on these pages is provided for information only, and may no longer be relevant!

Please, don't base your purchase decisions on information provided at this page, and consider starting a new topic instead

avatar zoranl Feb 15. 2012. 2:08 pm
I have created small application that uses the ActiveCollab API wrapper set of classes to help me do the actions I need.
However, I am using my own API key to connect to the API and users in the application are using same API key when they for example post new comments to some ticket.
When I create new comment from my app, no matter I give the object different values for createdByEmail and createdByName than my email and name, but the at the end the ticket is saved as created by me not the user I have assigned.
Could please someone let me know if the user is taken via the API key and not from the user I have set in the object?
avatar Ilija S. Staff Feb 15. 2012. 2:33 pm
Hello Zoran,

activeCollab always uses logged in user (in case of API, logged user is the user who's token is used for request authentication) when data is submitted.

When you submit new comments and specify created by details, does these users exist in activeCollab's People section or are they anonymous users (the don't have an account in the system)?
avatar zoranl Feb 15. 2012. 3:19 pm
Hey Ilija, thanks for your answer.
The user that I am trying to attach as Comment creator exists in our ActiveCollab database and is assigned to the same project and ticket for which I am creating the ticket.
avatar Ilija S. Staff Feb 15. 2012. 4:30 pm
In that case, look the user up, find their token and submit comment using their API key.
avatar zoranl Feb 15. 2012. 4:40 pm
Ah I knew I would have to do something like that :(
Anyhow Ilija thank you for your help
avatar zoranl Feb 15. 2012. 5:06 pm
I am using my own API and I have role of Project Manager, when I try to fetch all of the users for some company or by ID, I cannot fetch the API key for every user, do I need to have permissions as administrator to do that or?
avatar Ilija S. Staff Feb 15. 2012. 5:29 pm
Hello Zoran,

"token" value is returned only to administrators.
avatar zoranl Feb 15. 2012. 5:46 pm
Hey Ilija
Also, while I had the app locally it worked well, when I uploaded to the server the method: listCompanies returns the results in different format. Each company object details fields are empty arrays. Is this issue with the PHP versions difference maybe. Sorry to bother you and thank you for your help.
avatar Ilija S. Staff Feb 16. 2012. 10:05 am
Hello Zoran,

API should return the same result. What version of PHP do you have on your production server? And locally?
avatar zoranl Feb 16. 2012. 2:42 pm
Production server is PHP 5.2.8 and Locally I have 5.3.0 versions of PHP.
Specifically what I am doing is the following:

$path_info = '/people';
$response = ActiveCollab::callAPI();
	$result = array();
	$companies = ActiveCollab::convertXMLToArray($response,'company');
	foreach($companies as $comp)
		$result[] = $comp->getDetails();
	return $result;
return false;

This is my public method in my own class. When I am using it locally it returns set of arrays each with fields:
id, name, created_on,permalink... with the proper values as they are, but in production I am getting all these fields and their values are empty arrays.
This is very strange, I tried using API Keys from myself (project-manager) and from our Administrator, but the result is same.
If you need more info about this, please let me know and I will upload the files.
Thanks for your effort
or Go To Next Page

Try activeCollab for 30 days

Instant access and no credit card required