Menu
News
All News
Dungeons & Dragons
Level Up: Advanced 5th Edition
Pathfinder
Starfinder
Warhammer
2d20 System
Year Zero Engine
Industry News
Reviews
Dragon Reflections
White Dwarf Reflections
Columns
Weekly Digests
Weekly News Digest
Freebies, Sales & Bundles
RPG Print News
RPG Crowdfunding News
Game Content
ENterplanetary DimENsions
Mythological Figures
Opinion
Worlds of Design
Peregrine's Nest
RPG Evolution
Other Columns
From the Freelancing Frontline
Monster ENcyclopedia
WotC/TSR Alumni Look Back
4 Hours w/RSD (Ryan Dancey)
The Road to 3E (Jonathan Tweet)
Greenwood's Realms (Ed Greenwood)
Drawmij's TSR (Jim Ward)
Community
Forums & Topics
Forum List
Latest Posts
Forum list
*Dungeons & Dragons
Level Up: Advanced 5th Edition
D&D Older Editions
*TTRPGs General
*Pathfinder & Starfinder
EN Publishing
*Geek Talk & Media
Search forums
Chat/Discord
Resources
Wiki
Pages
Latest activity
Media
New media
New comments
Search media
Downloads
Latest reviews
Search resources
EN Publishing
Store
EN5ider
Adventures in ZEITGEIST
Awfully Cheerful Engine
What's OLD is NEW
Judge Dredd & The Worlds Of 2000AD
War of the Burning Sky
Level Up: Advanced 5E
Events & Releases
Upcoming Events
Private Events
Featured Events
Socials!
EN Publishing
Twitter
BlueSky
Facebook
Instagram
EN World
BlueSky
YouTube
Facebook
Twitter
Twitch
Podcast
Features
Top 5 RPGs Compiled Charts 2004-Present
Adventure Game Industry Market Research Summary (RPGs) V1.0
Ryan Dancey: Acquiring TSR
Q&A With Gary Gygax
D&D Rules FAQs
TSR, WotC, & Paizo: A Comparative History
D&D Pronunciation Guide
Million Dollar TTRPG Kickstarters
Tabletop RPG Podcast Hall of Fame
Eric Noah's Unofficial D&D 3rd Edition News
D&D in the Mainstream
D&D & RPG History
About Morrus
Log in
Register
What's new
Search
Search
Search titles only
By:
Forums & Topics
Forum List
Latest Posts
Forum list
*Dungeons & Dragons
Level Up: Advanced 5th Edition
D&D Older Editions
*TTRPGs General
*Pathfinder & Starfinder
EN Publishing
*Geek Talk & Media
Search forums
Chat/Discord
Menu
Log in
Register
Install the app
Install
Community
General Tabletop Discussion
*Geek Talk & Media
DDI Compendium API gotchas
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="mnology" data-source="post: 4995634" data-attributes="member: 73990"><p><strong>How to log in to the API</strong></p><p></p><p>First, your programming language of choice should have some API for automating interacting with webpages intelligently.</p><p></p><p>I'm a Perl programmer so I'm using WWW::Mechanize. It manages a www session and cookies for me and allows me to select a form, input fields and press form buttons on webpages really easily. I know ruby has a mechanize, and there's probably a python port too. I avoid microsoft languages & java like the plague. That said, this information should be able to get you on the right track no matter your language.</p><p></p><p>We're going to start with the base D&D Insider page, because this is where the login form is: <a href="http://www.wizards.com/dnd/Default.aspx" target="_blank">Dungeons & Dragons Roleplaying Game Official Home Page</a></p><p></p><p>On this page we want to work with the 'aspnetForm'</p><p>Username field: 'ctl00$ctl00$ctl00$ctl00$SiteContent$DnDContent$ctl00$UserName'</p><p>Password field: 'ctl00$ctl00$ctl00$ctl00$SiteContent$DnDContent$ctl00$UserPassword'</p><p>Login button: 'ctl00$ctl00$ctl00$ctl00$SiteContent$DnDContent$ctl00$LoginButton'</p><p></p><p>With WWW::Mechanize I can just populate the appropriate fields and say $mech->click($login_button) and I'm logged in.</p><p></p><p>The cookie for testing whether or not you are logged in is '.ASPXAUTH'</p><p></p><p>You can logout by going back to the original page, and if you're logged in the Login button ('ctl00$ctl00$ctl00$ctl00$SiteContent$DnDContent$ctl00$LoginButton') is the same one to 'click' to logout. When you do this the '.ASPXAUTH' cookie is cleared.</p><p></p><p>When logged in using the same mechanize instance, I can $mech->get($compendium_item_uri) and I can get the content of a compendium uri and get the actual results, and not the pesky log in content.</p><p></p><p>Check out my WIP: <a href="http://github.com/mnology/perl-ddi-compendium" target="_blank">mnology's perl-ddi-compendium at master - GitHub</a> for some real code.</p></blockquote><p></p>
[QUOTE="mnology, post: 4995634, member: 73990"] [b]How to log in to the API[/b] First, your programming language of choice should have some API for automating interacting with webpages intelligently. I'm a Perl programmer so I'm using WWW::Mechanize. It manages a www session and cookies for me and allows me to select a form, input fields and press form buttons on webpages really easily. I know ruby has a mechanize, and there's probably a python port too. I avoid microsoft languages & java like the plague. That said, this information should be able to get you on the right track no matter your language. We're going to start with the base D&D Insider page, because this is where the login form is: [url=http://www.wizards.com/dnd/Default.aspx]Dungeons & Dragons Roleplaying Game Official Home Page[/url] On this page we want to work with the 'aspnetForm' Username field: 'ctl00$ctl00$ctl00$ctl00$SiteContent$DnDContent$ctl00$UserName' Password field: 'ctl00$ctl00$ctl00$ctl00$SiteContent$DnDContent$ctl00$UserPassword' Login button: 'ctl00$ctl00$ctl00$ctl00$SiteContent$DnDContent$ctl00$LoginButton' With WWW::Mechanize I can just populate the appropriate fields and say $mech->click($login_button) and I'm logged in. The cookie for testing whether or not you are logged in is '.ASPXAUTH' You can logout by going back to the original page, and if you're logged in the Login button ('ctl00$ctl00$ctl00$ctl00$SiteContent$DnDContent$ctl00$LoginButton') is the same one to 'click' to logout. When you do this the '.ASPXAUTH' cookie is cleared. When logged in using the same mechanize instance, I can $mech->get($compendium_item_uri) and I can get the content of a compendium uri and get the actual results, and not the pesky log in content. Check out my WIP: [url=http://github.com/mnology/perl-ddi-compendium]mnology's perl-ddi-compendium at master - GitHub[/url] for some real code. [/QUOTE]
Insert quotes…
Verification
Post reply
Community
General Tabletop Discussion
*Geek Talk & Media
DDI Compendium API gotchas
Top