Post by Joe MartinezIan,
Thanks for the response. See my responses below...
Post by Ian McEwenI'm looking now.
The only thing that stands out to me is that ratings are numbers
between 0 and 100. I'm assuming you meant four stars, which would be 80,
not 4.
https://musicbrainz.org/doc/Rating_System
Do you know why it says 0-5, when it's really 0-100? Or, is that page
talking about something altogether different?
It's somewhat misleading -- the site only lets people set multiples of
20 (i.e., 1-5 "stars"), but on the backend it's 1-100.
https://musicbrainz.org/doc/Development/XML_Web_Service/Version_2#ratings
is fairly sparse but as you can see the example uses 20, which is
clearly not 1-5.
Post by Joe MartinezPost by Ian McEwenI'm not sure what exact process/tools you're using for submission since
I'm unfamiliar with C#, but it works fine with me with, at the command
curl --header "Content-Type: application/xml;charset=utf-8" -X POST
http://musicbrainz.org/ws/2/rating?client=ianmcorvidae-0.0.1
<?xml version="1.0" encoding="UTF-8"?>
<metadata xmlns="http://musicbrainz.org/ns/mmd-2.0#">
<recording-list>
<recording id="f5aec1b4-0162-489b-ad1a-2aeecebc7d8a">
<user-rating>80</user-rating>
</recording>
</recording-list>
</metadata>
Ok, so it sounds like the problem isn't with my XML at least. Must be
something else in what I'm doing.
Post by Ian McEwenLooking at the code, most normal errors should return an XML document
with the error, e.g. if I change 'recording' to 'event' (since events
<?xml version="1.0" encoding="UTF-8"?><error><text>Entity type 'event'
cannot have ratings. Supported types are: artist, recording, work,
http://musicbrainz.org/development/mmd</text></error>
One thing I might check is how your C# tools handle response bodies for
this sort of request -- perhaps it's throwing out the response that
would tell you what's wrong?
Well, the interesting thing is that when I have other errors, I DO get
something back.
Here's an example: If I leave out the User-Agent header, I get a Status
<?xml version="1.0" encoding="UTF-8"?><error><text>Your requests are being
throttled by MusicBrainz because the application you are using has not
identified itself. Please update your application, and see
http://musicbrainz.org/doc/XML_Web_Service/Rate_Limiting for more
http://musicbrainz.org/development/mmd</text></error>
So, I'm definitely looking in the right place. If I add the User-Agent
header back in, then again, I get a response status code of 400 Bad
Request, and an empty response body.
Hm, so at least that much is working, unless your library is doing
something in particular with 400 that it isn't with 503.
Post by Joe MartinezSo, I'm not really sure what might be wrong, I guess :( hopefully something
Post by Ian McEwenin
there helps. One other small thing I notice is that you're giving a
different client in the URL vs. the user-agent, which I'm guessing isn't
intentional.
Actually, it is intentional. From what I saw in the documentation, it
looks like User-Agent refers to the name/version of the client library, and
the client in the URL refers to the end user application.
https://musicbrainz.org/doc/Development/XML_Web_Service/Version_2#Submitting_data
"POST requests should always include a 'client' parameter in the URL (not
the body). The value of 'client' should be the ID of the client software
submitting data. This has to be the application's name and version number,
not that of a client library (client libraries should use HTTP's User-Agent
header). The recommended format is "application-version", where version
does not contain a - character."
Did I misinterpret that?
A bit. The user-agent should ideally reflect both the client library and
the end-user application; python-musicbrainzngs, which is typically our
go-to example library for this sort of thing, sets a useragent like
"MyApp/0.1 python-musicbrainzngs/0.5 ( contact info for MyApp )", by way
of a set_useragent function that takes the app name, the version number,
and the contact info (with the library inserting the
python-musicbrainzngs/0.5, or whatever version number, in the middle).
libmusicbrainz, the C library, works similarly.
The client parameter in the URL should identify the end-user
application, however, and generally doesn't include the library. In both
cases the goal is being able to distinguish submitted data that might be
suspect for whatever reason, whether it be bad coding, end-user misuse,
etc. Since bugs and misbehavior can originate in both a library and in
software using the library, we'd like to know about both!
Post by Joe MartinezPost by Ian McEwenHope you find out what's wrong!
Me too! I don't suppose there's a way I could send the response to a test
server that someone can look at and tell me what they see wrong on the
server side?
Presumably if you wanted to you could set up such a server yourself, but
that may not correspond to your investment in the problem! I suspect
that debugging this will require adding some debugging code (probably
just printlining) into the server itself as well -- the fact it's
failing without an error message suggests to me that it may be failing
somewhere that isn't in our part of the code but rather in the web
framework, but I'm not sure.
If you're interested in trying to test it yourself, you'll need something
running linux, and the codebase is at
https://bitbucket.org/metabrainz/musicbrainz-server/
If you're not:
On which platforms would your code run, and would you be able to send a
piece of test code and compilation instructions/a binary that fails in
this way? Most of the developers are *nix folks (Linux and Mac,
mostly), but I'm sure we could find a suitable Windows machine to test
with if that's how the compatibility falls.
Either way, assuming you come around when we're awake and paying
attention, the less-asynchronous place we work is the IRC channel
#musicbrainz-devel, on Freenode:
https://webchat.freenode.net/?channels=%23musicbrainz-devel will work if
you don't have an IRC client you prefer already. Working in realtime,
someone might be able to set up their sandbox
(http://wiki.musicbrainz.org/Development/Sandbox) for this temporarily,
which could be the best of both worlds.
P.S. given the possibility it's failing in the web framework, maybe
check character encodings? Windows at least tends to consider UTF-16
primary, which might suggest the presence of byte order marks. It's a
bit of a stretch, but...
Post by Joe Martinez_______________________________________________
MusicBrainz-devel mailing list
http://lists.musicbrainz.org/mailman/listinfo/musicbrainz-devel