getLocationRecentMedia($id) return an empty response #7

Closed
stephenyeargin opened this Issue Jun 2, 2012 · 4 comments

Projects

None yet

2 participants

@stephenyeargin
Contributor

Similar to what was happening in #2, given this sample code:

$recent = $instagram->getLocationRecentMedia($location_id);

generates a URL that looks like:

https://api.instagram.com/v1/locations/82127/media/recent/?max_id=0&min_id=0&max_timestamp=0&min_timestamp=0&access_token={access_token}

and a response that looks like:

`{

"pagination": { },
"meta": {
    "code": 200
},
"data": [ ]

}`

rather than the expected list of photos. The trouble, again like #2, is that the request is essentially asking the API "Give me everything that happened between timestamp/ID zero and timestamp/ID zero"

@stephenyeargin
Contributor

Might fix any other troubles with this not yet reported.

diff --git a/Instagram.php b/Instagram.php
index 4d4ad5d..588881d 100644
--- a/Instagram.php
+++ b/Instagram.php
@@ -44,7 +44,7 @@ class Instagram {
         'user_relationship' => 'https://api.instagram.com/v1/users/%d/relationship?access_token=%s',
         'modify_user_relationship' => 'https://api.instagram.com/v1/users/%d/relationship?action=%s&access_token=%s',
         'media' => 'https://api.instagram.com/v1/media/%d?access_token=%s',
-        'media_search' => 'https://api.instagram.com/v1/media/search?lat=%s&lng=%s&max_timestamp=%d&min_timestamp=%d&distance=%d&access_token=%s',
+        'media_search' => 'https://api.instagram.com/v1/media/search?lat=%s&lng=%s&max_timestamp=%s&min_timestamp=%s&distance=%s&access_token=%s',
         'media_popular' => 'https://api.instagram.com/v1/media/popular?access_token=%s',
         'media_comments' => 'https://api.instagram.com/v1/media/%d/comments?access_token=%s',
         'post_media_comment' => 'https://api.instagram.com/v1/media/%d/comments?access_token=%s',
@@ -53,11 +53,11 @@ class Instagram {
         'post_like' => 'https://api.instagram.com/v1/media/%d/likes',
         'remove_like' => 'https://api.instagram.com/v1/media/%d/likes?access_token=%s',
         'tags' => 'https://api.instagram.com/v1/tags/%s?access_token=%s',
-        'tags_recent' => 'https://api.instagram.com/v1/tags/%s/media/recent?max_id=%d&min_id=%d&access_token=%s',
+        'tags_recent' => 'https://api.instagram.com/v1/tags/%s/media/recent?max_id=%s&min_id=%s&access_token=%s',
         'tags_search' => 'https://api.instagram.com/v1/tags/search?q=%s&access_token=%s',
         'locations' => 'https://api.instagram.com/v1/locations/%d?access_token=%s',
-        'locations_recent' => 'https://api.instagram.com/v1/locations/%d/media/recent/?max_id=%d&min_id=%d&max_timestamp=%d&min_timestamp=%d&access_token=%s',
-        'locations_search' => 'https://api.instagram.com/v1/locations/search?lat=%s&lng=%s&foursquare_id=%d&distance=%d&access_token=%s',
+        'locations_recent' => 'https://api.instagram.com/v1/locations/%d/media/recent/?max_id=%s&min_id=%s&max_timestamp=%s&min_timestamp=%s&access_token=%s',
+        'locations_search' => 'https://api.instagram.com/v1/locations/search?lat=%s&lng=%s&foursquare_id=%s&distance=%s&access_token=%s',
     );
 
     /**
@ghost
ghost commented Dec 10, 2012

Excuse me, but I'm new to GIT, how can I run this ?

@stephenyeargin
Contributor

That's a good question. I know the command is git apply but I've rarely had to work with a manual patch (I pasted this here mostly for the original developer to take a look at before I considered creating a pull request).

Here's a general guide I found. The basic process will be to just save a file (e.g. fix_endpoints.patch) to the root of the cloned repository and then run the commands outlined in the guide below.

https://ariejan.net/2009/10/26/how-to-create-and-apply-a-patch-with-git

@macuenca
Owner

Hello Stephen, thank you for taking the time to look into this. Looks like your code fixes the problem, could you please send me a pull request with your patch so I can apply it?

@macuenca macuenca closed this in 2136172 Dec 11, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment