• chill-o-mat over 9 years ago

    Hi guys & gals,

    I've written a c# API wrapper with strong type support for the XML responses. Usage is pretty much fast forward:

    // instantiate the client
    MPW.Discogs.Client client = new MPW.Discogs.Client("<your-API-key>");

    // use it:
    Artist artist = client.GetArtist(4711);
    Release release = client.GetRelease(42);
    Label label = client.GetLabel(0815);
    Result[] results = client.Search("Blues Brothers Soul man");

    You can grab it here:
    http://rapidshare.com/files/270943148/marcs_discogs_.net_api.zip.html

    Do whatever you want with this, I'd appreciate a note if you like it.

    Have fun,
    marc
  • itz over 9 years ago

    Hi,

    I tried using your wrapper in a vb.net project and it works fine. Thank you!

    Is there a documentation for it?
    Or more specific:
    client.search(searchtext) returns only 20 results
    How can I move to the next results?
    And how can I get the number of results?

    Steffan
  • chill-o-mat over 9 years ago

    The number of results should be inside, there is a property NumberOfResults in the SearchResults class. It is fed by the attribute "numResult" of searchresults:

    <searchresults start="1" end="20" numResult="150">

    Your second question... well, it seems that the Discogs API itself provides no way of moving to the next 20 results. If it is possible, it could by added of course, but this is a limitation of the API, I guess.

    By the way, I'll update it in near future - I managed to unwrap the error response from the exception that is thrown when the HTTP status code is != 200. I added a new data type "Fault" that is a representation of an erroneus response (e.g. Status code 400 is returned when the 5000 requests per day and IP are exceeded. In the current version you'll just get an exception saying "400". The next release will give you the message from the API.

    Bye,
    marc

  • itz over 9 years ago

    itz edited over 9 years ago
    The limitation to 20 results seems not to be necessary. If you try
    http://www.discogs.com/artist/sex+pistols?f=xml&api_key=YOUR_KEY_HERE
    for instance in your browser you earn much more than 20 releases.
    Edit: I found this solution: http://www.discogs.com/help/forums/topic/169641

    Can you post a short code-snippet for the numResults-property? I can only access the MPW.Discogs.Data.Result and not the MPW.Discogs.Data.SearchResult

    Thanks,
    Steffan

Log In You must be logged in to post.