I've created a simple app for reading articles, which creates posts with the following code:
FB.api('/me/[NAMESPACE]:read&article=http://example.com/article.html','post', function(response) {
if (!response) {
alert('Error Occurred I got no response with ' + $pageURL);
}
else if (response.error) {
alert('Error Occurred' + response.responseText + " " + response.error.responseText);
} else {
alert('Post was successful! Action ID: ' + response.id);
var idToDeleteLater = response.id;
}
});
And I want to be able to check if the page had been visited before, so I'll be able to forbid any further creating of posts for the same article.
But in order to do that I'd need to get the article ID, and I haven't been able to get to it with the response.id command, since that one only gives me the ID of the individual post.
I don't want to use the given method:
function postUnreadSpecific()
{
var postId = idToDeleteLater;
FB.api(postId, 'delete', function(response) {
if (!response || response.error) {
alert('Error occured');
} else {
alert('Post was deleted');
}
});
Because the reading is done via a Button (same as in the tutorial with the cooking), so whenever I push the button new posts are created, with different ID's and I obviously don't wan't to type them manually.
So, bottomline, how does one get the page ID (not the post ID with response.id), and make a check, if the page had been visited before, disable creation of new posts...