http://blog.discogs.com/2011/06/api-v20.html

API v2.0
Today we are rolling out an updated version of the Discogs API! Our original API was released in 2007 and we've seen many interesting applications come out of it. This new version lays the foundation for more enhancements like user login, managing your collection/wantlist/sales inventory, and other cool things we'll be working on this year.

Some of the major changes:

The API uses a new url: api.discogs.com

An API key is no longer required

We have removed the 5,000 requests per day limit*

We are offering an official Python API client. Check it out on github. Feel free to fork it and submit pull requests. You can help us improve it!

Responses are returned in JSON format now. You can still request XML if you prefer that.

JSONP support

NOTE
We are phasing out the old API and it will be shut down on Dec 15, 2011. We will email all users with an API key asking them to migrate to the new version.

* API requests are still throttled, but if you are interested in unrestricted access, we are developing a premium API, please get in touch.

Comments

Karlheinz’s picture

Cool, thanks for this.

The lack of API key is awesome. I'm sure there'll be more to like.

Just in time for the D7 update, too. I already have to re-write much of the code, maybe now's the time to clean house.

EDIT: I think it is. The default format is now JSON, rather than XML. That is much more easy to implement in PHP. The only issue might be if the users don't have the PHP JSON library installed - but that's a requirement for D7 itself.

In the meantime, I'll fix up the D6 version to use the new API.

strawberrybrick’s picture

Karl, did the module get updated for the new API? I received this today:

Hello,

We are writing to you because you have registered for a Discogs API key.

As mentioned here: http://www.discogs.com/help/forums/topic/234138
we will be phasing out the version 1 API and would like all current users to upgrade their clients to use the version 2 API.

API version 1 will be discontinued on Jan 15, 2012. Please make sure to upgrade your clients before then. And let us know if you have any questions.

thanks,
Discogs

Karlheinz’s picture

It is not yet updated. I will be able to work on that again after my finals are over.

strawberrybrick’s picture

Hi Karl, Hope your finals went well. Any chance you've had to work on this? As always, thanks

strawberrybrick’s picture

Component: Miscellaneous » Code
Priority: Normal » Critical
Karlheinz’s picture

I've been working on this for the past week or so. Nearly all of the import stuff has to be re-written.

I was also hoping to get a D7 version done before the next semester starts up, but we'll see if that happens or not.

Karlheinz’s picture

Assigned: Unassigned » Karlheinz
Status: Active » Needs review
StatusFileSize
new40.1 KB

Okay, hopefully this should be working now.

In addition to using the updated Discogs API, there is now an additional form page on import, where you can select the label/artist whose releases you want imported. You should see what I mean when you use the module.

Also, this module now REQUIRES PHP 5 or better, with JSON support - specifically, the json_decode() function. This is a requirement for D7, incidentally, and I'm pretty sure everyone has it by now. I had to do this, as the new Discogs API no longer returns XML, but returns JSON objects exclusively.

This is a pretty major rewrite, so undoubtedly there are lots of bugs I didn't catch. Nonetheless, I pushed it to the -dev version just now, hopefully it will propagate soon.

I am also attaching a patch.

Please tell me about any issues. If there aren't any, I'd like to use (roughly) the same code when I write the D7 version.

strawberrybrick’s picture

Just installed the 6.x-1.x-dev version (2012-Jan-10) on test site and production site (clean install, deleted previous discogs), and happy to report was able to import discogs items successfully.

Will test more today.

# 1 - note that the artist field gets imported with a trailing "/", e.g. "Phil Manzanera /"
# 2 - there is no image preview for releases when confirming import

Karlheinz’s picture

# 1 - note that the artist field gets imported with a trailing "/", e.g. "Phil Manzanera /"

Oops. Yeah, I was trying to make the theme_discogs_artists() function more efficient, and I broke it. I fixed that, and am attaching a patch.

By the way, you should probably create a new issue for each new problem. I'm going to go through the issue list and clean stuff up. A lot of it is really fixed, but I didn't get enough feedback to actually close the issue. (And a lot of it is simply overwritten with the new update.) I'm also going to create a new tag.

# 2 - there is no image preview for releases when confirming import

I didn't think there was one before... Did you override any of the theme functions? If so, maybe that got broken somehow? I'm really just guessing here.

Because of the changes to the API, most of the theme functions did have to change slightly. The function to create a single checkbox's text is theme_discogs_checkbox_text(). A URI to a thumbnail image (on Discogs' server) is included there, but I couldn't figure out a way to make it look even remotely passable, so I figured I would just leave it out and let individual designers override it if they want. All the available fields are documented in the function's comment block.

Anyway, if the issue is that the theme function doesn't work as before, create another issue for that and I'll look into it.

strawberrybrick’s picture

Karl, I no longer have the issue with the trailing "/". Preview doesn't contain images, but that's a non-starter. Thanks for all your help on this.

Karlheinz’s picture

You're welcome.

I just found another bug to fix, so I'm not going to a 1.0 tag just yet, but it should be very soon.

I'm thinking that after 1.0, I will only be doing bug fixes, so I can concentrate on the D7 version.

Karlheinz’s picture

Are there any other problems with this? If not, I'm going to close this issue and move on.

strawberrybrick’s picture

Have been working flawlessly for over a year now, thanks as always.

Karlheinz’s picture

I am going to close this particular issue and move on.

However, right after you posted that, I found a (minor) bug that still needed to be fixed. D'oh! I did fix it, the patch is in the issue queue:
#1428150: Import data being stored with uid of 0

Karlheinz’s picture

Status: Needs review » Closed (fixed)