Asana Php api using Laravel

178 Views Asked by At

I am using Asana Php api in my Laravel project. I have a AsanaService class that only has create task function. Code:

public function createTask(Sale $sale,$short_payment){
    
        $headers = [
            'Asana-Enable: new_user_task_lists',
            'Asana-Disable: new_memberships,new_project_templates',
        ];
        


         $asana_client = Client::accessToken(
         env('ASANA_PERSONAL_ACCESS_TOKEN'),
         ['headers' => $headers]
        );

        $task_name = $sale->name;
     
        try {
            $result = $asana_client->tasks->create([
                'workspace' => env('ASANA_WORKSPACE_GID'),
                'name' => $task_name,
                'projects' => env('ASANA_PROJECT_GID'),
            ]);
        } catch (Asana\Errors\AsanaError $e) {
            echo 'Error: ' . $e->getMessage();
        }

        return $result;
    }

I am getting This request is affected by the "new_user_task_lists" deprecation or This request is affected by the "new_memberships" deprecation

I tried enabling or disabling and still get this error. In fact I tried every permutation of enabling or disabling or removing this 3 Headers. The only thing that works is 'log_asana_change_warnings' => false but i don't think that is the correct way? Any suggestions or tips how to fix this? And tasks will be created only in one project in one workspace. It was working fine till today. Thanks!

1

There are 1 best solutions below

0
DimisV On

I can not write a comment so I write here. It seems that there is a deprecation. I found also this that may help you, do you know that? There is an example

$client = Asana\Client::accessToken('ASANA_PERSONAL_ACCESS_TOKEN');