carbocation / go-instagram

Go library for accessing Instagram REST and Search APIs
BSD 2-Clause "Simplified" License
51 stars 20 forks source link

Covering more numeric types for media_count in Tags endpoints. #14

Closed gloob closed 8 years ago

gloob commented 8 years ago

Addressing issue #13 and #15

carbocation commented 8 years ago

I think the main question is whether we want to increment the API version of this library (i.e., increment by a version number, to 2.0), or to break with the Instagram API.

If we use floats rather than ints, then users of this library will mysteriously get compile-time failures unless we setup proper versioning.

If we cast Instagram's floats to ints, then users of this library may get an incorrect value if Instagram starts returning non-integer counts. But, it's a bit hard to understand why Instagram made this change. I have a hard time imagining that losing the decimal will impact many (any?) applications.

So, rather than change to floats, I think we should probably cast these counts from floats to ints to keep our API the same. Curious to get your thoughts, @gloob . Thanks!

gloob commented 8 years ago

Hi @carbocation thanks for the reply!

As first step I reported the issue to the Instagram (Facebook) folks to check if this is going to be fixed or it's an expected behaviour for long time.

So based on that answer (if it happens, let's give it a week for it) we can take a decision about which path to follow. I personally prefer to follow the float path plus version increment instead of the pre-filtering of the json because if this happened in one of the Tags endpoint it could happens in others too.

Let's wait for their reply if you don't mind. I'll keep updated this issue.

Cheers, Ale

gloob commented 8 years ago

Reply from Instagram. So it seems they will fix it, let's give them another pair of weeks.

Hi,

Thanks for your report and interest in the Instagram platform. We are looking into fixing this as soon as possible.

Best,

Jackie
-
Instagram Team

-----Original Message----
From: gloob@litio.org
To:
Subject: Report Developer Issue - /tags/search endpoint is returning float like number in media_count field.

Username: gloob00
Email address: gloob@litio.org
Client_id: d4063d2b8a9f45168ee3feebeaa4fce7
Which product is affected?: api_endpoint
Issue Summary: /tags/search endpoint is returning float like number in media_count field.
Description: Hi!

We are implementing a go(lang) library (https://github.com/carbocation/go-instagram) for Instagram a found that recently the returned result for /tags/search endpoint changed.

The rest of tags endpoints return numbers as decimal in the media_count field, but /tags/search return the media_count field with an extra .0 in every media_count field.

This created a problem with our json process (Tags.Search returned error: json: cannot unmarshal number 1674374.0 into Go value of type int)

Example:

https://api.instagram.com/v1/tags/search?q=test&access_token=YOUR_ACCESS_TOKEN

{
   "meta":{
      "code":200
   },
   "data":[
      {
         "media_count":1674374.0,
         "name":"test"
      },

      ... more values ...

      {
         "media_count":24839.0,
         "name":"testtrack"
      }
   ]
}

We are tracking this problem in this issue https://github.com/carbocation/go-instagram/issues/13

So, this is a final behaviour? or we should expect that will be fixed?

Thanks,
Ale

-----End Original Message-----
carbocation commented 8 years ago

Any update from Instagram on this front?

carbocation commented 8 years ago

I believe this issue is essentially fixed by Instagram now. Does that sound right?

gloob commented 8 years ago

Yes it is fixed by Instagram, sounds right.