Foursquare API: get set of featured photos - android

I'm working on Android app which uses Foursquare API. For fetching results I use /venues/explore endpoint. I want to make fancy detail screen with set of photos as Foursquare does(example) So, according to documentation, when I make request for nearby places, I use parameter venuePhotos=1, but always get one photo from the count result of featured photos (example). Is this a bug of API or I got it wrong :) ?
I'm using hurl.it for monitoring response from certain requests.
here is my API request(I removed my client id and secret):
GET https://api.foursquare.com/v2/venues/explore?venuePhotos=1&limit=10&radius=500&v=20160215&ll=55.693053,12.584903&client_secret=//&client_id=//
client_id:
client_secret:
limit: 10
ll: 55.693053,12.584903
radius: 500
v: 20160215
venuePhotos: 1
And I get always one photo in photo count for regular and featured photos in every venue. Response example:
{"reasons": {},"venue": {"id": "4c41ae26af052d7fbba97d79","name": "Femmeren - jazz-værtshus","contact": {},"location": {},"categories": [],"verified": false,"stats": {},"price": {},"rating": 8.2,"ratingColor": "73CF42","ratingSignals": 11,"allowMenuUrlEdit": true,"photos": {"count": 1,"groups": []},"hereNow": {},"featuredPhotos": {"count": 1,"items": []}},"tips": [],"referralId": "e-0-4c41ae26af052d7fbba97d79-3"},

Thanks for clarifying your question. The venuePhotos=1 parameter will include a single photo in the response from the venues/explore endpoint. This is extremely useful if you need to display a single photo in a list of venues. To get more photos for a venue, you need to hit the venues/photos endpoint and pass the venueId you want the photos from -> https://api.foursquare.com/v2/venues/VENUE_ID/photos

Related

Set paper size A4 while printing from google cloud print API

I have integrated Google cloud printing API in android application. I am printing image from GCP. Everything is working fine. I want to set paper size using API. Is that feasible?
Currently i am sending following data :
**URL :**...cloudprint/submit
**Param :**
printerid
file
title
contentType
As per google document, we can use ticket param for that. not sure what to send in this key.
Any help appreciated.
We need to pass the A4 specifications to the G.C.Printer.
You need to pass ticket in the path parameter along with printerid, file, title, contentType and should look like this:
ticket : {"version":"1.0","print":{"media_size":{"width_microns":210000,"height_microns":297000,"is_continuous_feed":false,"vendor_id":"ISO_A4"}}}
(^above are the specs of A4 media size)
Your params should look like this:
printerid : <printerid>
content: <content>
title : <title>
contentType: <contentType>
ticket : {"version":"1.0","print":{"media_size":{"width_microns":210000,"height_microns":297000,"is_continuous_feed":false,"vendor_id":"ISO_A4"}}}
Also, this works perfectly for GCP version 2.0
Ticket params is basically the settings we send to G.C.Printer and by default, it sends media type as "NA_LETTER". We can override the default settings by sending the ticket parameter to trigger the print.
GCP parses the ticket and uses the key value accordingly. If any key is wrong, it throws "unable to parse ticket" error.

Google StreetView/Map API

Is their any way to get nearby streetviews coordinates with respect to a particular location (coordinates)
Here, I am using this thing, but it is returning wrong information
.
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=13.0602543,77.6471364&radius=1000&type=streetview&sensor=true&key={API_KEY}
I would suggest using the Street View Image Metadata endpoint in order to get nearest available street view panorama.
In your case you can run the following request
https://maps.googleapis.com/maps/api/streetview/metadata?location=13.0602543%2C77.6471364&radius=1000&source=default&key=YOUR_API_KEY
This request returns the following response
{
"copyright":"© Prashant Dubey",
"date":"2018-09",
"location":{
"lat":13.0602702,
"lng":77.6470768
},
"pano_id":
"CAoSK0FGMVFpcFBLMTdMM25RWEMxWEk4TmJWZkdmbzZpdlZJdWZ0aHhmbFlyR2s.",
"status":"OK"
}
So you have here both the location and pano ID.
I hope this helps!

Why Flickr api working for only some amount of time

I am trying to access public feed via
https://api.flickr.com/services/feeds/photos_public.gne
which I get from
https://www.flickr.com/services/feeds/docs/photos_public/
but It says "Flickr API:Page not found"
so how to proceed?
(note:api works sometimes!)
The limit is 3.600 request per hour
https://www.flickr.com/services/developer/api/

Facebook Graph API unlike a liked post

I have a method in my app that allows the user to "like" a post in his/her news feed. It's done with a simple graph request using HttpMethod.POST. But when I try to do an "unlike" action using HttpMethod.DELETE, I get an error callback:
02-08 00:35:57.298: I/Detail(2628): {Response: responseCode: 403, graphObject: null, error:
{HttpStatus: 403, errorCode: 200, errorType: OAuthException, errorMessage: (#200)
Feed story publishing to other users is disabled for this application}, isFromCache:false}
Now I assume this has something to do with the latest attempt to make all apps that integrate with Facebook use all Facebook looking dialogs and styles, but I could be wrong. Here's the roadmap post that has me suspicious:
Removing ability to post to friends walls via Graph API We will
remove the ability to post to a user's friends' walls via the Graph
API. Specifically, posts against [user_id]/feed where [user_id] is
different from the session user, or stream.publish calls where the
target_id user is different from the session user, will fail. If you
want to allow people to post to their friends' timelines, invoke the
feed dialog. Stories that include friends via user mentions tagging or
action tagging will show up on the friend’s timeline (assuming the
friend approves the tag). For more info, see this blog post.
Any ideas on what I could be doing wrong, or is Facebook just ruining me? Thanks!
EDIT: Here's the code I'm using to run the request.
Request likeRequest = new Request(Utility.fbSession, null, null, null, new Request.Callback() {
#Override
public void onCompleted(Response response) {
String responseString = response.toString();
Log.i("Detail", responseString);
updateDetail();
}
});
HttpMethod nextLikeCall = HttpMethod.DELETE;
likeRequest.setHttpMethod(nextLikeCall);
likeRequest.setGraphPath(itemId+"/likes");
likeRequest.executeAsync();
When you grab the post id from the graph data, it should be in a format like: XXXXX_YYYYY. The XXXXX is simply the users id and YYYYY is the actual post id. What you need to do is extract and use just the YYYYY portion of the post id that graph gives you. so instead of graph.facebook.com/XXXXX_YYYYY/likes.... you want to send graph.facebook.com/YYYYY/likes. This will work with both liking and unliking, you can test in graph explorer first before hacking together a substring extraction method.
Not sure how to extract a section of a string on Android, but I know in Objective-C/iOS, it can be done like this (code not tested, for reference/idea) :
SString *actualPostIdStr; //The String we will put the actual postId in
NSString *oldIdStr = //<the string in format XXXXX_YYYYY>
NSInteger charCount = [oldIdStr length]; //get the length of the original XXXXX_YYYYY string
NSRange fRangeCount = [oldIdStr rangeOfString:#"_"]; //get count of characters to remove (XXXXXX)
if (fRangeCount.location != NSNotFound){
NSInteger startingPos = fRangeCount.location + 1; //get the starting character position of the actual postId
actualPostIdStr = [[oldIdStr substringWithRange:NSMakeRange(startingPos, charCount - startingPos)] copy];
}
Hope this helps.
EDIT:
Ok, so I have been playing around with likes all day... It seems that this method sometimes doesn't work, but it all depends on the type of graph object which you are attempting to like/unlike. For example... plain status posts, this method works perfectly. However, I ran into a problem when trying to like a photo with a message/story post object. It turns out, in the graph data for this type of post object with photo, there is an additional paramter called "object_id", in addition to the plain "id" that is in status post graph data. in this case, with the photo and story post, you need to pass the "object_id", unaltered for successful unliking.
This mess seems like either a bug on FB's end, or they are making changes and disallowing likes/unlikes from graph api & just forgot/haven't to told us yet :) hopefully the former. In the mean time, you're just going to have to use my above answer, but just make sure you test with as many different types of post objects you can find, and use if conditions when a different id (portion of "id"... "object_id"... etc) is required.
Sometimes Daniel McCarthy's method don't work. In this case we need get Graph API request XXX_YYYY, find field object_id and unlike this object_id fid.

FB graph api Profile feed (Wall) is not the same as Wall?

I'm using : graph.facebook.com/me/feed?access_token=... to get my wall in json format, however, I can't get all the wall. I can get almost all.
I can get the posts where I'am tagged with #my_name..
I can't get the posts where I'am invoqued by "Who are you with?" option..
however, in the wall web application y can see both messages. but using graph api not.
The documentaion says: "Profile feed (Wall): graph.facebook.com/me/feed?access_token=." ..
I thinks the Wall == graph.facebook.com/me/feed?access_token... but apparently I'm wrong :( ..
Thanks in advance ..
Edit.. more information:
Image 1: We can see posts 1,2,3 and 4 (in red) in the wall ..
Image 2: We can see that the posts 2 and 4 had disappeared of json result.
both, post 2 and 4 are using "Who are you with?" "With hall9000"..
Image 1: http://i.stack.imgur.com/y1mFp.png
Image 2: http://i.stack.imgur.com/9kIKG.png

Categories

Resources