Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$client->tags->getTags() throwing an InvalidRequestError #67

Open
guerrillacontra opened this issue May 19, 2020 · 1 comment
Open

$client->tags->getTags() throwing an InvalidRequestError #67

guerrillacontra opened this issue May 19, 2020 · 1 comment

Comments

@guerrillacontra
Copy link

guerrillacontra commented May 19, 2020

Theclient->tags->getTags()function should return a collection however in the request it is failing and throwing an InvalidRequestError.

This error is only thrown if I were to execute iterator_to_array.

Example to replicate:

        $client = Client::accessToken($api_token);

        $existingAsanaTags = iterator_to_array($client->tags->getTags(), true);

        print_r($existingAsanaTags);

Not sure what the Asana API is messing up in the URI as it appears to be calling a 'GET' to /tags and I am also using iterator_to_array($client->tasks->getTasksForProject($project_id), true); with no issues.

@rossgrambo-zz
Copy link
Contributor

rossgrambo-zz commented May 22, 2020

I think we need to do a better job of surfacing errors in this library...

Try wrapping it in a try catch. You'll see the error message the API is giving you:

try {
    $existingAsanaTags = $client->tags->getTags();

    foreach ($existingAsanaTags as $existingAsanaTag) {
        var_dump($existingAsanaTag);
    }
} catch (\Asana\Errors\AsanaError $e) {
    print_r($e->response->raw_body);
}

Hope this helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants