MyAnimeList.net

Forums

Recent Posts | My Watched Topics | My Ignored Topics | Search

Search using the API
MyAnimeList.net Forum »» Support »» Search using the API

#1
04-19-12, 5:39 AM

Offline
Joined: Jan 2010
Posts: 10
I suppose this is connected to special characters and stuff but I've run across some problems when searching for a title using the API. Particularly, I'm having trouble retrieving information for 'Rockman.EXE Beast+' which, when searched for, returns a 'NoContent' status. I had a similar problem with Black Rock Shooter (TV) but found that simply searching for 'BRS (TV)' solved it. With 'Rockman.EXE Beast+' though, I have no idea what I should search for instead.

My guess is that this is a problem with the '+' character so I'd like to know: what should I search for in such a case?
 
#2
04-19-12, 5:47 AM
DB Administrator
Offline
Joined: Aug 2007
Posts: 4230
I added the synonym "Rockman EXE Beast Plus", so you can search with that for now.

Not too sure how the other users using the api deal with special characters. Hopefully someone with more knowledge about that can help you out.
 
#3
04-19-12, 5:58 AM

Offline
Joined: Jan 2010
Posts: 10
Thank you for the quick response.

I usually parse for special characters before turning the stream into an actual XML so, although it's troublesome, it's been ok so far. The problem is indeed with titles like these that have apparently no way to be searched for with the API and I'm afraid there are more titles in such a situation =(

Anyways, thanks again for the quick fix =)
 
#4
04-20-12, 6:28 PM

Offline
Joined: May 2008
Posts: 4609
Because certain characters like + are special entities in URIs and HTTP, they need to be url-encoded into % values. The hex for + is 2b so it becomes %2B and your request would start with something like:

GET /api/anime/search.xml?q=Rockman.EXE+Beast%2B HTTP/1.1

Most languages have some sort of function built in to convert ("url-encode") to this format. This should also work with unicode, though there have been occasions where malformed unicode characters in the DB entries themselves won't match the correct unicode in the query. Please let us know in the database subforum here if you encounter issues like that.
Modified by saka, 04-21-12, 11:14 AM
 
#5
04-21-12, 8:32 PM

Offline
Joined: Jan 2010
Posts: 10
Perfect! There is indeed such a function. Thanks!

It's weird though, the character for space also needs to be encoded as %20 but I never had to worry about it... I guess '+' is just super special (concatenation etc.).
 
#6
04-22-12, 10:53 PM

Offline
Joined: May 2008
Posts: 4609
Whitespace should never exist in a url, but generally it is fixed automatically for you by the library you use to send the request. Spaces can be properly represented by %20 or simply + in the query part of the URI.
 
#7
10-13-12, 3:30 PM

Offline
Joined: Aug 2008
Posts: 1
The search method only returns 20 results, how can I get all of them?


Compare:

http://myanimelist.net/api/anime/search.xml?q=dragon

vs

http://myanimelist.net/anime.php?q=dragon
Feel the music in your heart ~
 
Top
Help     FAQ     About     Contact     Terms     Privacy     AdChoices