Retrieving the object ID of an Open Graph from a page's URL

Is there a way to obtain the Facebook Object ID associated with a page directly from the page itself?

For instance, if I requested the Object ID 325186347604922, this is what I received:

<pre>
{
  "url": ".../ricetta-bigne_salati.htm", 
  "type": "ricettepercucinare:recipe", 
  "title": "Bignè salati", 
  "image": [
    {
      "url": ".../magazine/wp-content/uploads/2013/03/101-150x150.jpg", 
      "width": 150, 
      "height": 150
    }
  ], 
  "description": "Gli ingredienti e la procedura per preparare la ricetta Bignè salati.", 
  "data": {
    "course": "Antipasto", 
    "foreign_id": 130400
  }, 
  "updated_time": "2013-03-28T10:12:17+0000", 
  "id": "325186347604922", 
  "application": {
    "id": "118665634826424", 
    "name": "Ricettepercucinare.com", 
    "url": "https://www.facebook.com/apps/application.php?id=118665634826424"
  }
}</pre>

However, how does a page like determine its own ID?

Thank you.

Answer №1

Currently, there is no way to retrieve an object ID from a URL, although it really should be possible.

An attempt can be made using the following method:

http://graph.facebook.com/?id=http://www.ricettepercucinare.com/ricetta-bigne_salati.htm

Unfortunately, this approach is not effective.

We recommend reporting this issue at developers.facebook.com/bugs

Answer №2

Have you seen this individual's solution:

function retrieveFacebookId(url, callback) {
  //refer to http://developers.facebook.com/docs/reference/fql/object_url/
  FB.api({
    method: 'fql.query',
    query: "SELECT id FROM object_url WHERE url = '" + url + "'"
  }, function(response) {
    callback(response[0].id);
  });
}

retrieveFacebookId("http://facebook.com", function (id) {
  alert("Facebook ID = " + id);
});

Answer №3

If you're wondering if it's possible with FQL, the answer is yes:

select id, url from object_url where url in ('http://www.watchth.is/movies/9166-baraka')

You can check it out in the Graph API Explorer here, or simply make an ajax call using this code:

https://graph.facebook.com/fql?q=select%20id%2C%20url%20from%20object_url%20where%20url%20in%20('http%3A%2F%2Fwww.watchth.is%2Fmovies%2F9166-baraka')&format=json&suppress_http_code=1

If you're interested, you can also read more about a similar question and thank Rees for their response here

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

An unexpected token error occurred while using JSON.parse in NodeJs, with the message stating: "SyntaxError: Unexpected token

My goal is to parse a JSON file by using the following code: var fileName = `./tasks/file-1.json` fs.readFile(fileName, function(err, data){ var parsedData = JSON.parse(data); console.log(`Entered ${parsedData.fname}`); }); The contents of my ...

The website is missing the display of Google Maps

The Google map is not displaying on my website page that uses PHP. I need assistance with this issue. Below is the webpage URL and the source code: <section class="meteor-google-map fullwidth block" style="height: 450px; border: solid transparent; bo ...

I've successfully created the file in C#, but unfortunately, nothing seems to happen when trying to download

After successfully creating a file and uploading it, I am facing an issue with downloading the created file. Despite checking if the file exists and attempting to download it using the code below, nothing happens when the button is clicked. [HttpPost] ...

Retrieve the element by clicking on its individual tooltip

I am currently struggling with a jQuery UI tooltip issue. Specifically, I would like to retrieve the element that the tooltip is associated with when clicking on it. My Approach So Far $(".sample").tooltip({ content: function () { return $(t ...

What types of events can be used to trigger the start of HTML5 audio playback in mobile Chrome?

When it comes to mobile browsers, Audio elements require user action before play can start. The click event usually satisfies this requirement, but touchstart doesn't seem to be an acceptable initiating event in Chrome on Android or iOS. (Refer below ...

Creating NextJS Route with Dynamic Links for Main Page and Subpages

In my NextJS project, I have dynamic pages and dynamic subpages organized in the following folders/files structure: pages ├── [Formation] ├── index.js │ ├── [SubPage].js Within index.js (Formation Page), I create links like this: < ...

What is the best method to trigger a reevaluation of static parameters?

Explanation behind my question Every day, I am sent two timestamps through MQTT at 01:15 - these timestamps represent the beginning and end of a daily event (in this case, when my children are at school). It may not be the most exciting information for a ...

A guide on how to correctly parse an AJAX response using jQuery

{"{\"3\":\"Dubai\",\"2\":\"Ajman\",\"1\":\"Abu Dhabi\",\"7\":\"Umm al-Quwain\",\"6\":\"Sharjah\",\"5\":\"Ras al-Khaimah\",\"4\ ...

A promise is given when a value triggers a function

Having a problem with my code in the second function. When I log inside the function, it works fine. But when I assign a variable and call the function, it returns a pending promise instead of true or false. const mongoose = require('mongoose') c ...

What is the best way to restructure this deeply nested JSON information?

I'm working with the payload structure of my API and I want to format the data in a way that allows for dynamic display on the frontend without hardcoding column names. Currently, I am using DRF, axios, and react-redux, but I feel like I may need to d ...

Issue with Canvas Update in Loop while Using Three.js Library

In the code snippet provided, it takes in a number of scans which is always set to 2880. The canvas is divided into 2880 sectors to cover a full 360°. The code runs a loop from 0 to 2880, rendering colored points in each sector from the center of the canv ...

Make TypeScript parameter optional if it is not supplied

I am working with an interface that defines scenes and their parameters: export interface IScene<R extends string> { path: R; params?: SceneParams; } The SceneParams interface looks like this: export interface SceneParams { [key: string]: s ...

Renaming form elements using JQuery's .load method

This is a page named A.html <form name=form> <input type=text id = txtA> </form> When I use jQuery to load it into B.html, it loads multiple times. <form name=form> <input type=text id = txtA> </form> <form name=f ...

What could be the reason for the lack of rendering in this imported React component using System.import?

I've been experimenting with dynamic code splitting using webpack 2 and react. As part of my testing, I decided to create a component that fetches code asynchronously: import React, { Component } from 'react' export class Async extends Com ...

Stop aspx button postback on click using cSharp

The following HTML code snippet includes an <asp:Button> element. <asp:Button ID="CalculateG481" runat="server" Text="Calculate" OnClick="CalculateG481_Click" /> When clicked, the button calls the function CalculateG481_Click but then initia ...

Dynamic content loading for Twitter Bootstrap Popover using Ajax

Below is my code for dynamic content loading in a popover using AJAX. The popover displays correctly after the initial load, but there is an issue with its behavior on the first "show" event – it appears and disappears immediately. $("a.mypopover"). ...

What are some techniques for transforming text into JSON format?

Beginner inquiry: I'm struggling with manipulating text using JavaScript. Here is the text I want to transform: "5555 55:55: John: New York 6666 66:66: Jack: Los Angeles" My desired output after manipulation: [{ name:"John", address:"New York", n ...

Displaying both items upon clicking

Hey there, I'm having an issue where clicking on one article link opens both! <span class='pres'><img src='http://files.appcheck.se/icons/minecraft.png' /></span><span class='info'><a href=&apo ...

Can you provide guidance on extracting keys and values from a JSON object in Java?

After successfully extracting data from a website, I received the following response: {"vulnerability":{"id":15017916,"status":"open","closed_at":null,"created_at":"2019-07-26T10:06:03Z","due_date":null,"notes":null,"port":[],"priority":null,"identifiers" ...

Quickest method for deriving a boolean value from multiple boolean inputs

Within a document, the keys isOccupied and vacant are being destructured. const { isOccupied, vacant } = doc || {}; boolDetermination = (isOccupied, vacant) => { if (isOccupied && isOccupied === vacant) { < --- Return isOccupied value ...