Skip to content

Incorrect implementation of updateTeam() #158

@takraj

Description

@takraj

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);
        }
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions