Forum Discussion
Akenefick
3 years agoGenius
I think you can use a Json subquery The Community API v2 request (khoros.com) to get the roles too while still making only one API request. I've had to do something similar to get labels for messages.
- keithkelly3 years agoLeader
Holy **bleep** it worked!
Here's a simple working Python script:
import json import requests headers = { "li-api-session-key": "XXX", "Content-Type": "application/json" } data = { "users": { "fields": ["login","roles"], "constraints": [], "subQueries": { "roles": { "fields": ["id", "name"], "limit": 20 } } } } response = requests.post("https://[your community]/api/2.0/search", headers=headers, json=data) print(response.json())
I'm looking forward to tweaking it a bit and using this in Excel or PowerBI PowerQuery. Thanks!
Related Content
- 3 years ago