Search code examples
basecamp

BaseCamp - List of Projects returns too many results


I am new to Basecamp and I am trying to get started with the API.

I am using the bcx-api.

In my basecamp account I have just 3 projects.

But, when I query the API for "List of Projects" I get 52 results and I cannot work out why!

Here is the documentation for "Projects":

https://github.com/basecamp/bcx-api/blob/master/sections/projects.md

And based on that I have written my function as follows:

public static List<Model.Project> GetListOfProjects(string username, string password, string accountid)
    {
        WebClient client = BuildWebClient(username, password);
        string json = client.DownloadString(@"https://basecamp.com/" + accountid + "/api/v1/projects.json");
        List<Model.Project> results = JsonConvert.DeserializeObject<List<Model.Project>>(json);
        return results;
    }

The URL looks right to me?

https://basecamp.com/1234567/api/v1/projects.json

I just cannot work out why it's returning 52 results and not 3?

It appears to be including discussions for some reason.

Can anyone see what I am doing wrong?

Thanks

UPDATE:

I just visited the url above in a web browser and logged in using my username/password and it returns just 3 results!!! - which is correct. UH?

Trev


Solution

  • The answer is that both are correct. Your user has access to 3 projects in that account, so making the request using your credentials should return just 3 projects. Making the request with the account owner credentials will show all the projects on the account (52).