DDI Compendium API gotchas

There's a third article on the API promised which is supposed to handle authentication and, they were a bit vague, but it sounded like it might have info on getting the "raw" data on the various rules components.

Of course, no telling when that's going to happen. :(
 

log in or register to remove this ad

What about the calls to the detail of the items. It appears that those are coming back as pre-formatted html? I wish they'd open that up with authentication and return the information in xml.
Yeah, all I do is open a window with a Webview inside with the address of the item. It isn't fancy, but its all the online compendium app does as well.
 

There's a third article on the API promised which is supposed to handle authentication and, they were a bit vague, but it sounded like it might have info on getting the "raw" data on the various rules components.

Of course, no telling when that's going to happen. :(
I;'ve been waiting in this as well.

I currently have a WPF applet that makes the calls and returns the HTML for teh individual item.

What I want, is for the individual item to be returned as XML based around an XSD. This would make return of the data and deserializing it into an object a trivial task. The object would be the pile of gold, assuming that it specifically defined elements like a monsters attacks, bonuses, defence attacked, etc..
 

I can't get anything out of this, even hitting it through IE.

Granted, I'm an intranet developer, so remote security is a bit out of my normal range, but this is very vexing. I can't even get a reference to this through Visual Studio. Anyone want to through me a bone -- just a single good connection would be awesome?
 

Err... Could you be a bit more descriptive with your issue? E.g. what, exactly, do you mean by anything? Authentication? Running searches? Connecting to the API?

Since you mention Visual Studio, I'm going to go on a wild leap of intuition here and guess that you're trying to add the API as a service reference and it's not working. If that's the case, as I mentioned in my original post the service itself is misreporting its location (see point 3 in my first post) and so you've gotta change that...

I'd give you more details, but I can't remember how I got it working in the first place, and can't recreate it at the moment. :( But there was some file hidden from view in the IDE, but visible in the normal file structure, an xml file with a weird extension. Near the bottom of that file were the URLs for the calls, and that's where you'd change them.
 

Sorry, I was kinda tired and frustrated last night.

I VS, I'm trying to add a web reference using the address you posted. I get a 403 exception, so I assume I somehow need to authenticate against my DDI subscription when having VS create the proxy class. As I said, I'm used to developing internal web services and authenticating against Windows tokens, so I'm figuring it's a pretty dumb question, overall.

The other thing I'm trying, without success, is to hit the asmx through IE and run the methods directly. For instance, I'd expect to be able to hit CompendiumSearch Web Service, type "Feat" in the box, click "Invoke", and get a chunk of XML back on the screen. Instead, I get a yellow ASP.NET error page that doesn't tell me anything of value.

Basically, I know there's something stupid I'm missing about invoking the web service and hoping someone whose done it successfully can tell me what. I'm a fairly experienced .NET developer, but web services are something I usually use only when I need to.

Edit: hmm... ENWorld auto-converted my URI to a title. The link is still valid, though.
 
Last edited:

Yeah, it doesn't work directly from the webpage for exactly the reason I stated... It's misconfigured. So when you submit the request, it's going to the wrong address.

Unfortunately, authentication is an issue I know pretty much nothing about. That said, I haven't needed to do any authentication to run queries in the past. I haven't touched the API in a while, though, so maybe they've changed it.
 



How to log in to the API

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: Dungeons & Dragons Roleplaying Game Official Home Page

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: mnology's perl-ddi-compendium at master - GitHub for some real code.
 

Remove ads

Top