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

Incorrect implementation of updateTeam() #158

Open
takraj opened this issue Oct 21, 2022 · 0 comments
Open

Incorrect implementation of updateTeam() #158

takraj opened this issue Oct 21, 2022 · 0 comments

Comments

@takraj
Copy link

takraj commented Oct 21, 2022

Hi,

I'm using version 1.0.0 of this library from Maven Central: https://mvnrepository.com/artifact/com.asana/asana/1.0.0
This is the latest version by the time of creating this ticket.

The current implementation of updating a Team calls the /teams endpoint:

This is also conform with the documentation: https://developers.asana.com/docs/update-a-team

However, if I attempt to call this API via curl, I always get the HTTP 404 error.

Example:

curl -v -X PUT https://app.asana.com/api/1.0/teams -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'Authorization: *****' -d '{"data": {"name":"abc","organization":"1203195973075798","description":"Lorem Ipsum"}}'

I also get the same error message, when I attempt to use the client library.

However, if I add the team ID to the URL, then I can successfully update it.

Example:

curl -v -X PUT https://app.asana.com/api/1.0/teams/1203218620623147 -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'Authorization: *****' -d '{"data": {"name":"abc","organization":"1203195973075798","description":"Lorem Ipsum"}}'

So this seems to be an error to be corrected both in the docs and the client.

I could work it around by this class:

public class CorrectedTeams extends TeamsBase {

        public CorrectedTeams(Client client) {
            super(client);
        }

        public ItemRequest<Team> updateTeam(String team)
                throws IOException {
            String path = format("/teams/%s", team);

            return new ItemRequest<Team>(this, Team.class, path, "PUT")
                    .query("opt_pretty", null)
                    .query("opt_fields", null)
                    .query("limit", (int) Client.DEFAULTS.get("page_size"))
                    .query("offset", null);
        }
    }
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

1 participant