Tagging demo with Freebase Suggest

November 8, 2007

I whipped up a quick example of tagging with Freebase Suggest.

This is just the client-side user interface. Integration with an existing tagging system is left as an exercise for the reader 😉

Screenshot of Tagging demo


Getting started with Freebase and PHP

July 4, 2007

It seems some of the Freebase API examples are broken. Thanks to Bart for the heads up.

(Update Nov 07 – Freebase no longer requires an account for read access. So the cookie is probably unnecessary. )

Here are the most basic steps to getting started with Freebase PHP:

  1. Check your webserver runs PHP
  2. Download TestFreebasePHP.php to your webserver.
  3. View the PHP script through your server, you should see ‘Query failed’
  4. Check you are logged into your Freebase account.
  5. Get your metaweb-user cookie. (With Firefox: Preferences, Privacy, Show Cookies, search ‘Freebase’). It should look like this:
    metaweb-user="Z|a_aaaaaaaaaa|a_#1111a1a1111...snip...ZaaZZaZZ1aZ/ZZ"
  6. Test your cookie using this shell one-liner
  7. Edit TestFreebasePHP.php and replace the dummy cookie with your own.
  8. View the PHP script through your web server. If you see ‘Query succeeded’ then all is well.

I challenge you to come up with a smaller test script!

You can see the script running successfully on my server:

Test Freebase access using PHP

Loading: http://www.freebase.com/api/service/mqlread?q={"query":[{"id":"/type/int"}]}

Query succeeded
Response:

{
  "status": "200 OK",
  "query": {},
  "code": "/api/status/ok",
  "messages": [],
  "result": {
    "query": [
      {
        "id": "/type/int"
      }
    ]
  }
}