How to deal with URLs with commas in Facebook Graph API

I would like to use Graph API to get some information about URLs.

It works like this:

http://graph.facebook.com/?ids=URL,URL2,URL3

However, when an URL contains comma, things get complicated. For

http://www.example.com/name,something

we get

http://graph.facebook.com/?ids=http%3A%2F%2Fwww.example.com%2Fname%2Csomething

what gives us:

{
   "error": {
      "message": "(#803) Some of the aliases you requested do not exist: something",
      "type": "OAuthException",
      "code": 803
   }
}

What can be done with URLs to avoid such errors?

Answers


Just double-URL-encode the comma, so use %252C for it:

http://graph.facebook.com/?ids=http%3A%2F%2Fwww.example.com%2Fname%252Csomething

It might look weird, because then the Graph API identifies this URL by http://www.example.com/name\u00252Csomething - but I just tested it by pointing a like button to a URL containing a comma (un-encoded), liked it – and afterwards it showed 1 share for this URL on the Graph.


Need Your Help

split space of a fixed size container equally. a case for flexbox?

html css flexbox

How can a HTML/CSS structure be designed, that splits a fixed size container horizontally into three parts. The first part should be as tall as it's content needs. The second and the third part would

Code duplication (or not) - JAVA

java interface instanceof code-duplication

I have a situation of code duplication (or is it ? ) and I don't know how to avoid it , but still keep clarity in my code.