Contents |
Get Power BI
Retrieving Public Data
- Go to the "Home" tab.
- Click on "Get Data".
- Choose "Web".
- Enter the API URL of the data you want to access.
Logging In
You will need to use the login action of the WikiTree API in order to retrieve private data such as your watchlist.
You will need your WikiTree account email and password.
To do this:
- Go to the "Home" tab.
- Click on "Get Data".
- Choose "Web".
- Enter http://apps.wikitree.com/api.php?action=login&email=EMAIL&password=PASSWORD, where EMAIL is your email, and PASSWORD is your password.
- If your login is successful, you should receive a userid, username, and token. You will need this for retrieving private data.
Retrieving Private Data
- Go to the "Home" tab.
- Click on "Get Data".
- Choose "Web".
- Choose "Advanced".
- In "URL parts", enter the API URL of the data you want to retrieve. For example, https://apps.wikitree.com/api.php?action=getWatchlist.
- Under "HTTP request header parameters", choose "Cookie".
- In the box next to "Cookie", you will need to enter information in the format wikidb_wtb_UserID=123; wikidb_wtb_UserName=Name-1; wikidb_wtb_Token=xyz123 using the information that you retrieved above:
- wikidb_wtb_UserID is the userid.
- wikidb_wtb_UserName is the username.
- wikidb_wtb_Token is the token.
Tutorial (Example) how to connect in Power Bi and transform Data
Here is Script From Advanced Editor, how to make easy read from WatchList:
- let
- //Login to Wikitree
- SourceUserLogin = Json.Document(Web.Contents("http://apps.wikitree.com/api.php?action=login&email="& emailLogin &"&password=" & pass)),
- login = SourceUserLogin[login],
- #"Converted to Table" = Record.ToTable(login),
- // Get Token after login
- #"Filtered Rows token" = Table.SelectRows(#"Converted to Table", each [Name] = "token"),
- TokenValue = #"Filtered Rows token"{0}[Value],
- // Get Username after login
- #"Filtered Rows username" = Table.SelectRows(#"Converted to Table", each [Name] = "username"),
- UsernameValue = #"Filtered Rows username"{0}[Value],
- // Get Userid after login
- #"Filtered Rows userid" = Table.SelectRows(#"Converted to Table", each [Name] = "userid"),
- UseridValue = #"Filtered Rows userid"{0}[Value],
- Source = Json.Document(Web.Contents("https://apps.wikitree.com/api.php?action=getWatchlist",
- [Headers=[Cookie="wikidb_wtb_UserID=" & Number.ToText(UseridValue) & "; wikidb_wtb_UserName=" & UsernameValue & "; wikidb_wtb_Token=" & TokenValue ]])),
- Source1 = Source{0},
- watchlist = Source1[watchlist],
- #"Converted to Table11" = Table.FromList(watchlist, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
- #"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table11", "Column1", {"Id", "Name", "FirstName", "MiddleName", "LastNameAtBirth", "LastNameCurrent", "Nicknames", "LastNameOther", "RealName", "Prefix", "Suffix", "BirthLocation", "DeathLocation", "Gender", "BirthDate", "DeathDate", "BirthDateDecade", "DeathDateDecade", "Photo", "IsLiving", "HasChildren", "NoChildren", "Privacy", "IsPerson", "Touched", "ShortName", "BirthNamePrivate", "LongNamePrivate", "LongName", "BirthName", "Manager", "DataStatus", "Privacy_IsPrivate", "Privacy_IsPublic", "Privacy_IsOpen", "Privacy_IsAtLeastPublic", "Privacy_IsSemiPrivate", "Privacy_IsSemiPrivateBio", "PhotoData", "Father", "Mother", "Parents"}, {"Id", "Name", "FirstName", "MiddleName", "LastNameAtBirth", "LastNameCurrent", "Nicknames", "LastNameOther", "RealName", "Prefix", "Suffix", "BirthLocation", "DeathLocation", "Gender", "BirthDate", "DeathDate", "BirthDateDecade", "DeathDateDecade", "Photo", "IsLiving", "HasChildren", "NoChildren", "Privacy", "IsPerson", "Touched", "ShortName", "BirthNamePrivate", "LongNamePrivate", "LongName", "BirthName", "Manager", "DataStatus", "Privacy_IsPrivate", "Privacy_IsPublic", "Privacy_IsOpen", "Privacy_IsAtLeastPublic", "Privacy_IsSemiPrivate", "Privacy_IsSemiPrivateBio", "PhotoData", "Father", "Mother", "Parents"})
- in
- #"Expanded Column1"