ajimix / asana-api-php-class Goto Github PK
View Code? Open in Web Editor NEWA dependency free, lightweight PHP class that acts as wrapper for Asana API. Lets make things fast and easy! :)
A dependency free, lightweight PHP class that acts as wrapper for Asana API. Lets make things fast and easy! :)
Am I missing anything on here or does this not have the delete option?
Thanks.
Trying to create a new task just like new-task-to-project.php
but task id is genrated EX (1.015460109095E+14) like this but new task is not adding and showing Error (while assigning project to task :404 error,).
$projectId & $taskId both are proper but no result..
`$asana->createTask(array(
"workspace" => "99915435644125", // Workspace ID
"name" => "Getting all info"// Name of task
));
if ($asana->hasError()) {
echo 'Error while project data: ' . $asana->responseCode;
return;
} else{
$taskId = $asana->getData()->id;
echo $taskId;
echo "<br>".$projectId."<br>";
$asana->addProjectToTask($taskId,$projectId);
if ($asana->hasError()) {
echo 'Error while assigning project to task: ' . $asana->responseCode;
} else {
echo 'Success to add the task to a project.';
}
}
`
Hi,
createProject method isn't working. Is there anything else that needs to be passed besides workspace,name and notes?
$asana = new Asana( array('apiKey' => $asana_key) );
$project_data = array('workspace' => $workspace_id, 'name' => $project_name,'notes' =>'Project notes');
$created_project = $asana->createProject( $project_data );
I can create a task in the same workspace successfully but creation of project in the same workspace always returns 400 error. Are there any restrictions while creating project using API key?
Hey! im trying to use those examples on my localhost, but it's not working. Im getting a 500 status always...i know it's not your code but my server..but, do you have any clue about what can i do? i'd reallly appreciate it (':
Hello,
Thank you for sharing!
I'm trying to use functions Create Task / Update Task / Comment on task , but i have some problems.
Create Task : response code 400
Comment on task : response code 400
Update Task : response code 200 , Although the code does not make the update and returns the task , in its first status.
Sorry for my english
I would appreciate any help.
Androniki
Hi Adria,
I've been using your code for few weeks now and everything seemed to work well until my list got a bit out of hand. It took me a little while to troubleshoot it, but I ended up finding that if the list contains more than 1000 items, it just won't return anything.
That includes completed tasks too, so even if I have 5 items in my list but completed 996 tasks before, it would return null.
Cheers,
T.
Anyone know how to add a custom field when creating a task?
I can't get createProject() to work. I am getting the correct workspace from getWorkspaces (I know this because I can create a task), but createProject always returns 400 error. Can you provide a code sample that works?
Thanks so much for your help!
Asana responded with HTTP error: 400
Is it possible to create a new project through this API?
I modified the class and added:
public function createProject($workspaceId, $name){
$data = array( 'name' => $name,
'workspace' => $workspaceId,
'notes' => 'n/a',
'archived' => false
);
return $this -> askAsana($this->workspaceUrl.'/'.$workspaceId.'/projects', $data, METHOD_POST);
}
but it doesn't seem to work..
Hi,
Sorry ajimix! this is not an issue, this is just my request if possible. I'm new on Git and don't know where I should add request instead issue sections.
Your code is really helpful and I'm using. Now I need to add attachment to task. Is it possible to add attachment when I create new task. I see there is an option at bottom of doc page
http://developer.asana.com/documentation/
Thanks
~Anas
Hi,
Your project has been a time saver for me and a lot of others. Thank you for that. Your wrapper class does everything that one might need.
However, I would want to know one thing. You have written down many functions like getProjectTasks()
, getTasksWithTag()
, etc. where one can retrieve tasks within a particular set. But there seems to be no such function for getting tasks within Teams. By studying the data returned by Asana using your functions, there is no mention of a task belonging to a particular 'team'. Also, even when I export data as JSON through Asana's web application the teams find no mention. From what I understand, Asana itself does not provide an association between teams and tasks. Please correct me if I am wrong.
But if I am right at my conclusion, is there a workaround I could use? Teams are an important part of my data rendering and I need them to be mapped correctly in my reports that I am trying to generate from Asana. The report I want to generate would be hierarchical in nature:
Organization | Team | Project | Task |
---|---|---|---|
A | 1 | a | Task 1a |
Task 2a | |||
b | Task 1b | ||
Task 2b | |||
2 | c | Task 1c | |
Task 2c | |||
B | 3 | d | Task 1d |
Task 2d |
Can I do something to achieve this hierarchy?
Regards,
Mayank Choudhary
the getProjectsInWorkspace function doesn't seem to work.
php parsing stops once it hits it.
my syntax/usage
$result = getProjectsInWorkspace($workspaceID, $archived);
Hey ajimix,
Not certain this is actually on your end, but the CURL calls are taking anywhere from 1 to 4 seconds to load their return data. This is fine for small calls, but on projects where I'm loading in a lot of tasks, load times take well over 40 seconds per page load.
Any idea how we could speed this up?
Best,
Martin
We can not install ~4.2
, it seems Packagist is not in sync with the repo: https://packagist.org/packages/ajimix/asana-api-php-class
Did you setup the service hook? https://packagist.org/about#how-to-update-packages
Someone's API key is here: https://github.com/ajimix/asana-api-php-class/blob/master/examples/get-task-details.php
Hi.
I try to develope an app for view the tasks in a graphic but the Asana API doesn't response. I use the get-project-tasks.php example for test my server and I receive the following response:
Array
(
[url] => https://app.asana.com/api/1.0/tasks?project=14565209359219&
[content_type] =>
[http_code] => 0
[header_size] => 0
[request_size] => 0
[filetime] => -1
[ssl_verify_result] => 0
[redirect_count] => 0
[total_time] => 0
[namelookup_time] => 0.029504
[connect_time] => 0
[pretransfer_time] => 0
[size_upload] => 0
[size_download] => 0
[speed_download] => 0
[speed_upload] => 0
[download_content_length] => -1
[upload_content_length] => -1
[starttransfer_time] => 0
[redirect_time] => 0
[certinfo] => Array
(
)
)
Error while trying to connect to Asana, response code: 0
I know that probably the problem are in my server, but you have an idea about what I'm doing wrong?
I was searching information about this error code but I don't find anything.
Any help about it are welcome.
Thx.
Hello,
Is there an API to create a tag for a particular workspace?
There are methods to get tags and update tag but no method to create tag.
Asana documents to create a tag https://asana.com/developers/api-reference/tags#create
Maybe I'm doing something wrong, but I can't seem to get line breaks to show up in the notes of tasks.
I've tried \n, \n\r, <br>, but they all just render as is. Any ideas? My code looks like:
$result = $asana->createTask(array(
'workspace' => '498346170860',
'projects' => array('35253997924569'),
'name' => 'Contact: '.$_GET['name'],
'notes' => 'Contact Information:\n\r'.$_GET['name'].'\n\rPhone: '.$_GET['phone'].'\n\rEmail: '.$_GET['email'],
'assignee' => '[email protected]'
));
Why this attribute is for ? it's not used in the class ?
private $timeout = 10;
Hey first and foremost thank you for this script and your work, it is a timesaver!
I am using your example of get-all.php and trying to filter the tasks to just be todays tasks. Below is what I have, hoping you can shed some light on it, looking at the asana class I thought I was doing everything right.
$tasks = $asana->getProjectTasks($project->id, array('assignee_status' => 'today'));
Hi,
Your API is amazing. Thanks for sharing.
When I turned the debug mode to true in asana.php, the following error showed up:
Undefined variable: info in C:\wamp\www\AGA\asana\asana.php on line 875
$info["http_code"] variable was not available. I tried to go through all the possible places, but I couldn't find this one.
Any hints?
Best,
Akki
Hi,
I seem to be getting a 400 error when trying to use any of the create methods:
$workspaceId = '<id>'; $teamId = '<id>'; $asana->createProject([ 'name'=>'project Name', 'workspace'=>$workspaceId, 'team'=>$teamId, 'notes'=>'some notes' ]);
Hey!
Is this repo still up-kept? The getTasksByFilter function doesn't work on our end. Any chance there's a bug in there somewhere?
Hi!
I've made a couple of edits to the code to allow usage of the class with access tokens generated by oAuth App user logins, this prevents one from having to manually ask for the API key. Where can I push these? Not so familiar with pushing stuff to git :)
Cheers, Mike
Hi guys!
I have successfully used this script times before but now I need to create a webhook and it simply would not authorize me for the exact same access token I use to pull a task, which works:. SO I am able to get details on a task, but when I try to create a webhook I get a 400 error :(
Your help would be greatly appreciated, thank you!
So Asana has now removed the API key ability to create tasks.
However they do have a personal token that you can have each user create and use.
Any plans to update this code so it will work again without switching to OAuth??
Hello ajimix! Thank you for Asana API PHP Class! Can you add function to your example.php which add task to specify project?
P.S: Sorry for my bad english!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.