How do I get the "highlighted" status of a photo? - facebook-graph-api

In the following screenshot, one of the images (top right) is "highlighted". How do I get this status programmatically?

You can use
[pageid]?fields=posts.fields(timeline_visibility) ,
The return data wil have a field "timeline_visibility" : "starred"
But its only works for facebook pages, when i tried to get for my timeline
[userid]?fields=id,name,posts.fields(timeline_visibility)
return value is "timeline_visibility": "no timeline unit for this post"

Related

Facebook Graph api profile picture URL

I'm trying to display the profile pic of the logged in user but for some reason the url gets changed. This is the function i've put together
function testAPI() {
FB.api('/me','GET',{"fields":"picture{url},name"},function(response) {
var url = response.picture.data.url;
console.log(url);
$("#status").html('<p>'+response.name+'</p><figure id="profilePicture"><img href="'+response.picture.data.url+'"/></figure>');
console.log(document.getElementById('status').innerHTML);
});
}
the first console log returns:
"https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xpf1/v/t1.0-1/p50x50/12036592_10153768750487873_8195289030629933305_n.jpg?oh=5488c4b312a1b077b68243a7998d217e&oe=56BA5DE5&gda=1454718467_89331767e8555ed196c5559340774fbb"
the second returns the correct inner html as the users name diplays but its adding amp; after the & symbols in the url so the profile pic isn't displaying. No idea how to fix this. Any help would be great thanks.
You have incorrect <img/> tag syntax, you should be using src instead of href
Change:
$("#status").html('<p>'+response.name+'</p><figure id="profilePicture"><img href="'+response.picture.data.url+'"/></figure>');
To:
$("#status").html('<p>'+response.name+'</p><figure id="profilePicture"><img src="'+response.picture.data.url+'"/></figure>');

get high res images for events in facebook timeline

i am receiving the timeline of a fb page, including events.
The given picture for all Entries is usually a low res thumbnail.
I tryed querying for higher res images using the object id like this:
FacebookRequest($session, 'GET', '/' . $objectId . '?fields=images', []);
But i get an error:
#100 Tried accessing nonexisting field (images) on node type (Event)
Is there any way to get the high-res pictures for events in the timeline?
Am i doing something wrong here?
The Event node type don't have an images field, but a Photo node have one.
So you should first get '/' . $objectId . '?fields=cover' to get the cover photo node id, and then call '/' . $coverId . '?fields=images'.

Issue with postfinance module in oscommerce

I have integrated postfinance module for oscommerce. I have done everything mentioned in http://addons.oscommerce.com/info/6442 docs.When I tried to test it in 'test mode' ...after selecting the payment method it is redirecting to 'Order success' page with out showing option to enter postfinance card details....in the admin panel it shows that a purchase has been made and it is processing.
At your checkout_confirmation.php please replace:
if ($$payment->code == 'paypal_ipn') {
with
if (isset($$payment->form_action_url)) {

Graph API: Can I make multi-calls at a same time?

In fact, I want to get the cover photo for each user's albums.
So, first I get the albums data:
$albums = $GLOBALS["facebook"]->api("/me/albums",'GET');
Then I retrieve the cover_photo id and ask API to get details about this photo (such as the source)
foreach($albums as $album) {
$data = $GLOBALS["facebook"]->api("/". $album["cover_photo"], 'GET');
}
But this make a lot of calls to the API (one per album) and it's seems that she doesn't like.. Because my application return a timeout error.
Is there another way to do what I want?
Thanks.
You can always use the Batch API, or just use FQL. Something like the below would retrieve the src of all the album covers of the current user:
SELECT src
FROM photo
WHERE pid IN (
SELECT cover_pid
FROM album
WHERE owner = me()
)
You can try it here. Obviously you can choose any field to retrieve from the photo table.

Amazon Product Advertising API: Get Average Customer Rating

When using Amazon's web service to get any product's information, is there a direct way to get the Average Customer Rating (1-5 stars)? Here are the parameters I'm using:
Service=AWSECommerceService
Version=2011-08-01
Operation=ItemSearch
SearchIndex=Books
Title=A Game of Thrones
ResponseGroup=Large
I would expect it to have a customer rating of 4.5 and total reviews of 2177. But instead I get the following in the response.
<CustomerReviews><IFrameURL>http://www.amazon.com/reviews/iframe?...</IFrameURL></CustomerReviews>
Is there a way to get the overall customer rating, besides for reading the <IFrameURL/> value, making another HTTP request for that page of reviews, and then screen scraping the HTML? That approach is fragile since Amazon could easily change the reviews page structure which would bust my application.
You can scrape from here. Just replace the asin with what you need.
http://www.amazon.com/gp/customer-reviews/widgets/average-customer-review/popover/ref=dpx_acr_pop_?contextId=dpx&asin=B000P0ZSHK
As far as i know, Amazon changed it's API so its not possible anymore to get the reviewrank information. If you check this Link the note sais:
As of November 8, 2010, only the iframe URL is returned in the request
content.
However, testing with the params you used to get the Iframe it seems that now even the Iframe dosn't work anymore. Thus, even in the latest API Reference in the chapter "Motivating Customers to Buy" the part "reviews" is compleatly missing.
However: Since i'm also very interested if its still possible somehow to get the reviewrank information - maybe even not using amazon API but a competitors API to get review rank informations - i'll set up a bounty if anybody can provide something helpful on that. Bounty will be set in this topic in two days.
You can grab the iframe review url and then use css to position it so only the star rating shows. It's not ideal since you're not getting raw data, but it's an easy way to add the rating to your page.
Sample of this in action - http://spamtech.co.uk/positioning-content-inside-an-iframe/
Here is a VBS script that would scrape the rating. Paste the code below to a text file, rename it to Test.vbs and double click to run on Windows.
sAsin = InputBox("What is your ASIN?", "Amazon Standard Identification Number (ASIN)", "B000P0ZSHK")
if sAsin <> "" Then
sHtml = SendData("http://www.amazon.com/gp/customer-reviews/widgets/average-customer-review/popover/ref=dpx_acr_pop_?contextId=dpx&asin=" & sAsin)
sRating = ExtractHtml(sHtml, "<span class=""a-size-base a-color-secondary"">(.*?)<\/span>")
sReviews = ExtractHtml(sHtml, "<a class=""a-size-small a-link-emphasis"".*?>.*?See all(.*?)<\/a>")
MsgBox sRating & vbCrLf & sReviews
End If
Function ExtractHtml(sHtml,sPattern)
Set oRegExp = New RegExp
oRegExp.Pattern = sPattern
oRegExp.IgnoreCase = True
Set oMatch = oRegExp.Execute(sHtml)
If oMatch.Count = 1 Then
ExtractHtml = Trim(oMatch.Item(0).SubMatches(0))
End If
End Function
Function SendData(sUrl)
Dim oHttp 'As XMLHTTP30
Set oHttp = CreateObject("Msxml2.XMLHTTP")
oHttp.open "GET", sUrl, False
oHttp.send
SendData = Replace(oHttp.responseText,vbLf,"")
End Function
Amazon has completely removed support for accessing rating/review information from their API. The docs mention a Response Element in the form of customer rating, but that doesn't work either.
Google shopping using Viewpoints for some reviews and other sources
This is not possible from PAPI. You either need to scrape it by yourself, or you can use other free/cheaper third-party alternatives for that.
We use the amazon-price API from RapidAPI for this, it supports price/rating/review count fetching for up to 1000 products in a single request.