Listing.price inconsitency

20 views
Skip to first unread message

kevinyc

unread,
Oct 5, 2010, 2:59:10 AM10/5/10
to Etsy API V2
I am having trouble with some methods returning Listings with price as
a float and others returning it as a string. I haven't tried many
methods yet but the two that I am using just happen to be formatting
the price differently.

findAllFeaturedListingPickerActive returns Listing associations with
price as strings while findAllListingActive returns listings with
price as floats.

I read on another discussion that listing prices are supposed to be
strings despite what it says in the documentation. So, I'm guessing
that there is a bug with the findAllListingActive method.

Julian L.

unread,
Oct 5, 2010, 7:09:59 AM10/5/10
to etsy-...@googlegroups.com
I think I've noticed some inconsistency with this before, too. It's easy to not when using some happy-go-lucky language like PHP or JavaScript, but receiving a price as a string when a decimal is expected, or vice versa, raises errors with more strongly typed languages such as Python or Java.

I just tried http://openapi.etsy.com/v2/public/listings/active?api_key=<glrk>&limit=10, though and all of the prices to appear to be coming back as strings.
Same with http://openapi.etsy.com/v2/public/homepages/pickers?limit=1&includes=Listings&api_key=<bieber>.

Do you have any specific examples that show this behavior? What language or json decoding method are you using? Is it intermittent, or every time for these methods?

Have a nice morning,
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.
>

kevinyc

unread,
Oct 5, 2010, 4:08:14 PM10/5/10
to Etsy API V2
I am still working in the sandbox but here are a couple of examples
all using the findAllListingsActive method.

http://openapi.etsy.com/v2/sandbox/public/listings/active?api_key=<key>&limit=10&fields=price

This returns price as mix of strings and floats but mostly strings.

{"count":50100,"results":[{"price":5},{"price":"5.00"},
{"price":"5.00"},{"price":"15.00"},{"price":"12.00"},{"price":"12.50"},
{"price":"20.00"},{"price":"25.00"},{"price":"23.00"},
{"price":"26.00"}],"params":{"limit":"10","offset":
0,"keywords":null,"sort_on":"created","sort_order":"down","min_price":null,"max_price":null,"color":null,"color_accuracy":
0,"tags":null,"materials":null,"category":null},"type":"Listing"}

http://openapi.etsy.com/v2/sandbox/public/listings/active?api_key=<key>&limit=10&fields=price&category=toys

Here they are all floats.

{"count":41854,"results":[{"price":18},{"price":36},{"price":25},
{"price":25},{"price":5},{"price":35},{"price":12.5},{"price":7},
{"price":10},{"price":15}],"params":{"limit":"10","offset":
0,"keywords":null,"sort_on":"created","sort_order":"down","min_price":null,"max_price":null,"color":null,"color_accuracy":
0,"tags":null,"materials":null,"category":"toys"},"type":"Listing"}

It seems like once I add additional search parameters, prices are
always coming back as floats. I'm currently writing in objective-c and
the decoding library is parsing the types correctly. I can work around
it but I just wanted to point it out in case it's a bug.


On Oct 5, 4:09 am, "Julian L." <jul...@craftcult.com> wrote:
> I think I've noticed some inconsistency with this before, too. It's easy to not when using some happy-go-lucky language like PHP or JavaScript, but receiving a price as a string when a decimal is expected, or vice versa, raises errors with more strongly typed languages such as Python or Java.
>
> I just triedhttp://openapi.etsy.com/v2/public/listings/active?api_key=<glrk>&limit=10, though and all of the prices to appear to be coming back as strings.
> Same withhttp://openapi.etsy.com/v2/public/homepages/pickers?limit=1&includes=...<bieber>.

Justin Kerr Sheckler

unread,
Oct 5, 2010, 5:14:31 PM10/5/10
to etsy-...@googlegroups.com
Hi guys, thanks for pointing out this strange behavior. We'll take a
closer look.

JKS

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

Reply all
Reply to author
Forward
0 new messages