[ANNOUNCE] Data type fixes on Listings

34 views
Skip to first unread message

Justin Kerr Sheckler

unread,
Jan 25, 2011, 11:48:15 AM1/25/11
to etsy-...@googlegroups.com
Hi there,

We just pushed a small change to make sure that empty tags and materials are always arrays, and that listing prices are always strings (and not actual floats.)


Justin Kerr Sheckler
Developer API Lead
Etsy.com
jus...@etsy.com

Julian L.

unread,
Jan 25, 2011, 8:24:36 PM1/25/11
to etsy-...@googlegroups.com
This change  has triggered exceptions in code which previously had been running without error for months.

I have a line 

    if 'price' in listing: listing['price']=float(listing['price'])

This is now throwing an exception 'empty string for float()' for sold_out listings.

Previously sold_out listings did not have a price in the return data at all, but now they have an empty string. (I'm talking about the Treasury methods, haven't had a chance to look at everything else yet).

Just thought I'd let you know that changes like this do cause errors. Advance notice would be appreciated.

Thanks,
Julian


--
You received this message because you are subscribed to the Google Groups "Etsy API V2" group.
To post to this group, send email to etsy-...@googlegroups.com.
To unsubscribe from this group, send email to etsy-api-v2...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/etsy-api-v2?hl=en.

GraGra33

unread,
Jan 25, 2011, 8:29:08 PM1/25/11
to Etsy API V2
The price change has also caused problems for us as we weren't
expecting a string. It appears to affect all resources.

G.

Julian L.

unread,
Jan 25, 2011, 8:48:48 PM1/25/11
to etsy-...@googlegroups.com
Also, does this mean that 'price' will be present for all listings as '' when a listing is sold_out or otherwise unavailable?

Previously it was not in the data at all.

Thanks,
Julian

Daniel Dickison

unread,
Jan 26, 2011, 8:39:50 AM1/26/11
to etsy-...@googlegroups.com
I think this was caused by the price data type change from yesterday: Listings returned by the FeaturedListing.Listing association all have empty strings for price iff the Listing association is included a second time without the price field. I include the association twice in order to get the FeaturedListing.Listing.MainImage association AND the FeaturedListing.Listing.Shop association, given the limitation on nested associations as discussed elsewhere[1].

[1]: http://groups.google.com/group/etsy-api-v2/browse_thread/thread/85c81bd5a7ea2220/466e51794fd7d3da

Here is the actual request that my app sends:
http://openapi.etsy.com/v2/public/homepages/listings/active?api_key=****&includes=Listing(title,state,listing_id,price,currency_code):25:0/MainImage(listing_image_id,rank,url_75x75):25:0,Listing(listing_id):25:0/Shop(shop_id,shop_name):25:0&limit=20&offset=0

I just noticed that while previously this type of request would return the Listing association twice for each FeaturedListing, once with all the fields and the second with just the ID, it is now returning just a single Listing per FeaturedListing, with each Listing containing both MainImage and Shop associations. This is actually nice, but as a side effect the prices seem to have been wiped out. I can fix it by including all of the necessary fields in the second include as well. Is this an intended change, and should I count on this behavior to be stable?

Daniel

Daniel Dickison

unread,
Jan 26, 2011, 8:47:51 AM1/26/11
to etsy-...@googlegroups.com
I should note that this isn't only with FeaturedListing -- the same thing happens when getting Listings via association from FavoriteListing and ShopSection.

Justin Kerr Sheckler

unread,
Jan 26, 2011, 10:22:24 AM1/26/11
to etsy-...@googlegroups.com
Hi guys,

Apologies for the unexpected change.  There are two previous thread related to this issue:


It was mentioned before that we're standardizing on string representations for prices, because they avoid any precision errors.  I took it as read that the strings were the expected values, and it was the floats that were causing problems.

I'm curious how your code was dealing with the inconsistency before, without raising any exceptions?

About prices on sold listings: Etsy has never displayed prices on any sold listings, and we won't do that in the future (that's considered private information between the seller and the buyer.)

best,


Justin Kerr Sheckler
Developer API Lead
Etsy.com
jus...@etsy.com



Julian L.

unread,
Jan 26, 2011, 11:35:16 AM1/26/11
to etsy-...@googlegroups.com
Only a few calls were sending floats instead of strings for the price. I listed a few examples here http://groups.google.com/group/etsy-api-v2/browse_thread/thread/a5a1963551efed64/e46d43a975adf44b?hl=en&lnk=gst&q=price+bug#e46d43a975adf44b

In situations like that, I usually just work around glitches in the specific call. When glitchy behavior is fixed, though, such workarounds might start to throw an error.

My question about sold listing prices was not whether we can get the price, as of course I'm aware that Etsy doesn't supply prices for sold listings (as a matter of trivia, actually prices were visible on sold items up until sometime in 2007, when pressure from a persistent group of sellers in the forums made Etsy decide to remove them).

The problem I was having was not the change to strings, but the fact that price is now included in the data for sold/inactive items at all.  

Previously, sold_out, removed, expired and edit state items did not have a price field. Now they have a price field and it is "".  My code was checking whether price was included in the data sent, and if it was, trying to cast it to a float.  The price field appearing all of a sudden in states where it previously was absent messed an if/else check ("if 'price' in listing:"). This means  Python was throwing an ValueError "empty string for float()"  because float("") is invalid. 

Thanks,
Julian

Justin Kerr Sheckler

unread,
Jan 26, 2011, 2:14:54 PM1/26/11
to etsy-...@googlegroups.com
The problem I was having was not the change to strings, but the fact that price is now included in the data for sold/inactive items at all.  

That was definitely a bug!  We just pushed a fix for that now.

Justin Kerr Sheckler
Developer API Lead
Etsy.com
jus...@etsy.com



Justin Kerr Sheckler

unread,
Jan 26, 2011, 2:58:04 PM1/26/11
to etsy-...@googlegroups.com
Yes, the empty string prices were a bug.  We've pushed a fix for that already.

Justin Kerr Sheckler
Developer API Lead
Etsy.com
jus...@etsy.com



Daniel Dickison

unread,
Jan 26, 2011, 9:31:51 PM1/26/11
to etsy-...@googlegroups.com
Yup -- I can confirm that this is now fixed. Thanks!

Julian L.

unread,
Jan 27, 2011, 7:58:31 AM1/27/11
to etsy-...@googlegroups.com
Oh good, thanks for setting that straight!

Have a nice morning,
Julian

kevinyc

unread,
Feb 11, 2011, 8:50:05 PM2/11/11
to Etsy API V2
I'm still getting prices returned as integers if the listing was
created/updated using createListing or updateListing.

POST/PUT: price=200.00
Listing price field: price = 200

POST/PUT: price=20.50
Listing price fiel: price = "20.5"

POST/PUT: price=999.99
Listing price fiel: price = "999.99"

Here's one of my listing that is returning the price as an integer.
The listing was created and updated through the api.
http://openapi.etsy.com/v2/public/listings/67941506

Kevin

Justin Kerr Sheckler

unread,
Feb 14, 2011, 2:13:51 PM2/14/11
to etsy-...@googlegroups.com
Hi Kevin

I'm afraid I'm not able to reproduce the problem you're describing.
Could you send us full requests that were made, including request and
response headers? Thanks.

Justin Kerr Sheckler
Developer API Lead
Etsy.com
jus...@etsy.com

kevinyc

unread,
Feb 14, 2011, 5:21:06 PM2/14/11
to Etsy API V2
Hi Justin,

I did a little more testing and I found out that the problem goes away
after a few minutes. It was causing a crash because I didn't handle
those types.

Request Header:

Authorization = "OAuth realm="", oauth_consumer_key="__consumerkey__",
oauth_token="__token__", oauth_signature_method="HMAC-SHA1",
oauth_signature="__signature__", oauth_timestamp="1297720965",
oauth_nonce="12B0C7EA-9F2F-4007-A2A2-8017660F6377",
oauth_version="1.0"";
"Content-Length" = 2663;
"Content-Type" = "application/x-www-form-urlencoded";

Request Body:

title=Test%20Listing%20-%20Do%20not%20purchase&description=This%20is
%20a%20test%20listing.%20Do%20not%20buy.%0A%0ALorem%20ipsum%20dolor
%20sit%20amet%2C%20consectetur%20adipiscing%20elit.%20Nulla%20laoreet
%20lacus%20et%20purus%20convallis%20vel%20porta%20lacus%20imperdiet.
%20Quisque%20a%20placerat%20tellus.%20Sed%20accumsan%20augue%20sed
%20elit%20dictum%20luctus.%20Sed%20blandit%20tellus%20et%20arcu
%20aliquet%20vel%20ultrices%20nibh%20consectetur.%20Maecenas%20nec
%20nunc%20vel%20elit%20mollis%20aliquam.%20Sed%20dapibus%20posuere
%20justo%20ut%20gravida.%20Duis%20mollis%20adipiscing%20metus%20vitae
%20tincidunt.%20Ut%20ut%20purus%20nunc.%20Fusce%20tincidunt%20sodales
%20arcu%20ac%20rhoncus.%20Quisque%20imperdiet%20interdum%20sem%2C%20a
%20dictum%20magna%20accumsan%20non.%20Nullam%20et%20tortor%20augue.
%20Donec%20vel%20ante%20ut%20lacus%20pellentesque%20rhoncus%20id%20sed
%20ligula.%20Praesent%20gravida%2C%20nibh%20ac%20fringilla%20blandit%2C
%20massa%20mi%20tempus%20risus%2C%20eu%20feugiat%20magna%20nibh%20id
%20risus.%20Nullam%20blandit%20facilisis%20quam%20nec%20bibendum.
%20Mauris%20cursus%20nulla%20vitae%20elit%20vehicula%20gravida%20non
%20ut%20neque.%20Pellentesque%20porttitor%20gravida%20nibh%2C
%20pellentesque%20dignissim%20libero%20fermentum%20sed.%20Suspendisse
%20eget%20metus%20eros.%20Vivamus%20sagittis%2C%20ligula%20vel
%20dignissim%20lobortis%2C%20turpis%20quam%20laoreet%20sem%2C%20a
%20vestibulum%20mauris%20turpis%20quis%20diam.%20Proin%20nibh%20libero
%2C%20iaculis%20nec%20pretium%20eu%2C%20vestibulum%20non%20urna.
%20Pellentesque%20habitant%20morbi%20tristique%20senectus%20et%20netus
%20et%20malesuada%20fames%20ac%20turpis%20egestas.%0A%0ADonec%20vitae
%20dolor%20sit%20amet%20lacus%20blandit%20tristique.%20Curabitur%20ut
%20nulla%20eros%2C%20ac%20tincidunt%20dui.%20Quisque%20eu%20odio%20sed
%20tellus%20viverra%20condimentum.%20Donec%20tempor%20ante%20ut%20diam
%20venenatis%20vel%20lobortis%20lorem%20vulputate.%20Suspendisse
%20aliquet%20pharetra%20nisi%20ultrices%20vehicula.%20Mauris%20rutrum
%20ultricies%20quam%2C%20ut%20molestie%20augue%20venenatis%20a.
%20Phasellus%20lectus%20nisl%2C%20viverra%20et%20auctor%20et%2C
%20dapibus%20ut%20justo.%20Duis%20nec%20ullamcorper%20turpis.%20In
%20hac%20habitasse%20platea%20dictumst.%20Morbi%20rhoncus%20ligula
%20quis%20dolor%20porta%20a%20gravida%20purus%20lacinia.%20Nullam
%20dictum%20suscipit%20velit%20eget%20vulputate.%20Morbi%20viverra%2C
%20leo%20vel%20egestas%20congue%2C%20dolor%20lectus%20fringilla%20enim
%2C%20in%20lacinia%20nulla%20dui%20et
%20tellus.&quantity=1&price=200.00&tags=everything%20else%2Cdo%20not
%20buy%2Ccraftsy%2Ctest%2Cdev&shop_section_id=7544123&materials=air
%2Cnothing

Response Header:

"Accept-Ranges" = bytes;
"Content-Length" = 5051;
"Content-Type" = "application/json";
Date = "Mon, 14 Feb 2011 22:09:42 GMT";
Server = Apache;
"X-Mashery-Responder" = "proxyworker-i-d43825bc.mashery.com";

Response Body:

{"count":1,"results":[{"listing_id":
67941506,"state":"active","user_id":11136786,"title":"Test Listing -
Do not purchase","description":"This is a test listing. Do not buy.\n
\nLorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla
laoreet lacus et purus convallis vel porta lacus imperdiet. Quisque a
placerat tellus. Sed accumsan augue sed elit dictum luctus. Sed
blandit tellus et arcu aliquet vel ultrices nibh consectetur. Maecenas
nec nunc vel elit mollis aliquam. Sed dapibus posuere justo ut
gravida. Duis mollis adipiscing metus vitae tincidunt. Ut ut purus
nunc. Fusce tincidunt sodales arcu ac rhoncus. Quisque imperdiet
interdum sem, a dictum magna accumsan non. Nullam et tortor augue.
Donec vel ante ut lacus pellentesque rhoncus id sed ligula. Praesent
gravida, nibh ac fringilla blandit, massa mi tempus risus, eu feugiat
magna nibh id risus. Nullam blandit facilisis quam nec bibendum.
Mauris cursus nulla vitae elit vehicula gravida non ut neque.
Pellentesque porttitor gravida nibh, pellentesque dignissim libero
fermentum sed. Suspendisse eget metus eros. Vivamus sagittis, ligula
vel dignissim lobortis, turpis quam laoreet sem, a vestibulum mauris
turpis quis diam. Proin nibh libero, iaculis nec pretium eu,
vestibulum non urna. Pellentesque habitant morbi tristique senectus et
netus et malesuada fames ac turpis egestas.\n\nDonec vitae dolor sit
amet lacus blandit tristique. Curabitur ut nulla eros, ac tincidunt
dui. Quisque eu odio sed tellus viverra condimentum. Donec tempor ante
ut diam venenatis vel lobortis lorem vulputate. Suspendisse aliquet
pharetra nisi ultrices vehicula. Mauris rutrum ultricies quam, ut
molestie augue venenatis a. Phasellus lectus nisl, viverra et auctor
et, dapibus ut justo. Duis nec ullamcorper turpis. In hac habitasse
platea dictumst. Morbi rhoncus ligula quis dolor porta a gravida purus
lacinia. Nullam dictum suscipit velit eget vulputate. Morbi viverra,
leo vel egestas congue, dolor lectus fringilla enim, in lacinia nulla
dui et tellus.","creation_tsz":1297471631,"ending_tsz":
1307764800,"original_creation_tsz":1297471631,"last_modified_tsz":
1297721854.62,"price":"200","currency_code":"USD","quantity":"1","tags":
["everything_else","do_not_buy","craftsy","test","dev"],"materials":
["air","nothing"],"shop_section_id":
7544123,"featured_rank":null,"state_tsz":1297721854.62,"hue":
0,"saturation":0,"brightness":26,"is_black_and_white":true,"url":"http:
\/\/www.etsy.com\/listing\/67941506\/test-listing-do-not-purchase?
utm_source=craftsy&utm_medium=api&utm_campaign=api","views":
10,"num_favorers":0,"ShippingInfo":[{"shipping_info_id":
351771055,"origin_country_id":
209,"destination_country_id":null,"currency_code":"USD","primary_cost":"30.00","secondary_cost":"30.00","listing_id":
67941506,"region_id":null,"origin_country_name":"United
States","destination_country_name":"Everywhere Else"}]}],"params":
{"listing_id":"67941506","quantity":"1","title":"Test Listing - Do not
purchase","description":"This is a test listing. Do not buy.\n\nLorem
ipsum dolor sit amet, consectetur adipiscing elit. Nulla laoreet lacus
et purus convallis vel porta lacus imperdiet. Quisque a placerat
tellus. Sed accumsan augue sed elit dictum luctus. Sed blandit tellus
et arcu aliquet vel ultrices nibh consectetur. Maecenas nec nunc vel
elit mollis aliquam. Sed dapibus posuere justo ut gravida. Duis mollis
adipiscing metus vitae tincidunt. Ut ut purus nunc. Fusce tincidunt
sodales arcu ac rhoncus. Quisque imperdiet interdum sem, a dictum
magna accumsan non. Nullam et tortor augue. Donec vel ante ut lacus
pellentesque rhoncus id sed ligula. Praesent gravida, nibh ac
fringilla blandit, massa mi tempus risus, eu feugiat magna nibh id
risus. Nullam blandit facilisis quam nec bibendum. Mauris cursus nulla
vitae elit vehicula gravida non ut neque. Pellentesque porttitor
gravida nibh, pellentesque dignissim libero fermentum sed. Suspendisse
eget metus eros. Vivamus sagittis, ligula vel dignissim lobortis,
turpis quam laoreet sem, a vestibulum mauris turpis quis diam. Proin
nibh libero, iaculis nec pretium eu, vestibulum non urna. Pellentesque
habitant morbi tristique senectus et netus et malesuada fames ac
turpis egestas.\n\nDonec vitae dolor sit amet lacus blandit tristique.
Curabitur ut nulla eros, ac tincidunt dui. Quisque eu odio sed tellus
viverra condimentum. Donec tempor ante ut diam venenatis vel lobortis
lorem vulputate. Suspendisse aliquet pharetra nisi ultrices vehicula.
Mauris rutrum ultricies quam, ut molestie augue venenatis a. Phasellus
lectus nisl, viverra et auctor et, dapibus ut justo. Duis nec
ullamcorper turpis. In hac habitasse platea dictumst. Morbi rhoncus
ligula quis dolor porta a gravida purus lacinia. Nullam dictum
suscipit velit eget vulputate. Morbi viverra, leo vel egestas congue,
dolor lectus fringilla enim, in lacinia nulla dui et
tellus.","price":"200.00","materials":"air,nothing","renew":null,"tags":"everything
else,do not
buy,craftsy,test,dev","shipping_template_id":null,"shop_section_id":"7544123","state":"active"},"type":"Listing"}

Justin Kerr Sheckler

unread,
Feb 16, 2011, 12:29:41 PM2/16/11
to etsy-...@googlegroups.com
Hi Kevin,

When you say "goes away in a few minutes" do you mean something like this:

1. PUT request to a listing with a new price
2. Price is returned incorrectly (from PUT request, or from a subsequent GET?)
3. Wait a little while
4. Price is returned correctly

...?  Or if that's not the sequence, can you describe what is?  That may help me localize this problem.

Thanks.

Justin Kerr Sheckler
Developer API Lead
Etsy.com
jus...@etsy.com



2011/2/14 kevinyc <kev...@gmail.com>

kevinyc

unread,
Feb 16, 2011, 4:04:19 PM2/16/11
to Etsy API V2
Yes, that's the correct sequence.

The price is returned incorrectly from the PUT request and from all
subsequent GET for a few minutes.

Kevin

On Feb 16, 9:29 am, Justin Kerr Sheckler <jus...@etsy.com> wrote:
> Hi Kevin,
>
> When you say "goes away in a few minutes" do you mean something like this:
>
> 1. PUT request to a listing with a new price
> 2. Price is returned incorrectly (from PUT request, or from a subsequent
> GET?)
> 3. Wait a little while
> 4. Price is returned correctly
>
> ...?  Or if that's not the sequence, can you describe what is?  That may
> help me localize this problem.
>
> Thanks.
>
> Justin Kerr Sheckler
> Developer API Lead
> Etsy.com
> jus...@etsy.com
>
> 2011/2/14 kevinyc <kevi...@gmail.com>
> > 209,"destination_country_id":null,"currency_code":"USD","primary_cost":"30. 00","secondary_cost":"30.00","listing_id":
> > buy,craftsy,test,dev","shipping_template_id":null,"shop_section_id":"754412 3","state":"active"},"type":"Listing"}
>
> > On Feb 14, 11:13 am, Justin Kerr Sheckler <jus...@etsy.com> wrote:
> > > Hi Kevin
>
> > > I'm afraid I'm not able to reproduce the problem you're describing.
> > > Could you send us full requests that were made, including request and
> > > response headers?  Thanks.
>
> > > Justin Kerr Sheckler
> > > Developer API Lead
> > > Etsy.com
> > > jus...@etsy.com
>
> > > On Fri, Feb 11, 2011 at 8:50 PM, kevinyc <kevi...@gmail.com> wrote:
> > > > I'm still getting prices returned as integers if the listing was
> > > > created/updated using createListing or updateListing.
>
> > > > POST/PUT: price=200.00
> > > > Listing price field: price = 200
>
> ...
>
> read more »
Reply all
Reply to author
Forward
0 new messages