Skip to main content

I have a requirement to fetch the list of teams a user is a part of

Please help on how I can achieve this? 

There isn’t an endpoint that does this for you, but you are able to get a list of teams in an organization, and then search the teams for their members, and filter out your user from there

 

https://developers.miro.com/reference/getteams

 

Please keep in mind, that these APIs require an active enterprise plan in order to work.


Hi @Addison Schultz 

The response of this does not have team members in it. Is there any other alternative?


@HarshitaVishwakarma Is organization using the enterprise plan?


Yes. I am able to list the teams, and get the team by it’s id but the response does not have team members in it. 


After you get the teamId, you will then need to call this endpoint to get users of that team: https://developers.miro.com/reference/getmembers


Got it. But unfortunately there is a limit of returning only 100 teams in the list teams API whereas I am dealing with 100+ teams. Is there any way to overcome this?

On a side-note the solution you provided looks good but seems like it will take a lot of looping and iterations to achieve it, especially when the data is huge. What are your thoughts on this?


 

You can set one of the parameters that should return more than 100 teams. Regarding the looping over data - this is the recommend way you should approach this

 


Okay thanks. And I tried setting the limit to 200 but I get back this error: 

{

    "status": 400,

    "code": "invalidParameter",

    "message": "org.springframework.validation.BeanPropertyBindingResult: 1 errors\nField error in object 'teamsCursorQuery' on field 'limit': rejected value Â200]; codes eMax.teamsCursorQuery.limit,Max.limit,Max.int,Max]; arguments .org.springframework.context.support.DefaultMessageSourceResolvable: codes lteamsCursorQuery.limit,limit]; arguments u]; default message ilimit],100]; default message  limit value should be less than 100]",

    "type": "error"

}

Seems like the docs don’t mention that 100 is the max limit. 


Thanks for reporting - this is a bug in our docs, I’ll pass it over to our team. 

That being said, are you able to use the cursor parameter to find the next item(s) in the iteration?


No problem. I tried the cursor parameter and it works. Just so my understanding isn’t wrong, so adding the cursor like this:

https://api.miro.com/v2/orgs/<org_id>/teams?limit=100&cursor=<100th team’s ID>

will return the next 100 teams based on the 100th team’s id and so on, correct?

P.S: There’s another bug in the docs for this API

Should be: https://api.miro.com/v1/oauth-token

Currently it is: https://api.miro.com/v1/v1/oauth-token


Yes, that is correct!


Great! Thanks so much for your help. I really appreciate it 🙂


Reply