title: How to publish Actions to Facebook Graph API with parameters in call URL
body: <p>To begin, Ive spent several hours looking for an answer and have come CLOSE but havent found a full answer.</p>
  
  <p>So Im trying to publish actions using Facebook's Graph API and want to send parameters in the URL when initially calling it with the Facebook Javascript SDK.</p>
  
  <p>Here is a call that WORKS:</p>
  
  <pre><code>  function postNewAction()
    {
            passString = '&amp;object=http://mysite.com/appnamespace/object.php';
  
            FB.api('/me/APP_NAMESPACE:ACTION' + passString,'post',
               function(response) {
                    if (!response || response.error) {
                        alert(response.error.message);
                    } 
                    else {
                        alert('Post was successful! Action ID: ' + response.id);
                    } 
                }
            );    
     }
  </code></pre>
  
  <p>With object.php looking like so:</p>
  
  <pre><code>  &lt;head xmlns:enemysearch="http://apps.facebook.com/APP_NAMESPACE/ns#"&gt;
      &lt;meta property="fb:app_id" content="APP_ID" /&gt; 
      &lt;meta property="og:type" content="APP_NAMESPACE:object" /&gt; 
      &lt;meta property="og:title" content="some title" /&gt;
      &lt;meta property="og:description" content="some description"/&gt; 
      &lt;meta property="og:locale" content="en_US" /&gt;
      &lt;meta property="og:url" content="http://www.mysite.com/appnamespace/object.php"/&gt;
    &lt;/head&gt;
  </code></pre>
  
  <p>So obviously the above will post some sort of action to Facebook that will be the same every time object.php is called.</p>
  
  <p>This is not ideal for my purposes.</p>
  
  <p>So I took a look at <a href="https://stackoverflow.com/questions/8431694/dynamic-generation-of-facebook-open-graph-meta-tags">this thread</a> and it helped but as you will see, doesnt answer everything.</p>
  
  <p>So if I change object.php to include dynamically generated meta tags by using content from either GET or POST and use the <a href="http://developers.facebook.com/tools/debug" rel="nofollow noreferrer">Object Debugger</a> with a matching URL format to the one provided in og:url, the debugger shows everything as working as I would expect with now warnings. Here is what the dynamically generated object.php looks like:</p>
  
  <pre><code>   &lt;?php
        if(count($_GET) &gt; 0) {
       $userName = (int)$_GET['userName'];
        }
        else {
       $userName = (int)$_POST['userName'];
        }
     ?&gt;
    &lt;head xmlns:enemysearch="http://apps.facebook.com/APP_NAMESPACE/ns#"&gt;
      &lt;meta property="fb:app_id" content="APP_ID" /&gt; 
      &lt;meta property="og:type" content="APP_NAMESPACE:object" /&gt; 
      &lt;meta property="og:title" content=" &lt;?php echo $userName; ?&gt;" /&gt;
      &lt;meta property="og:description" content="Click to view more from &lt;?php echo $userName; ?&gt;"/&gt; 
      &lt;meta property="og:locale" content="en_US" /&gt;
      &lt;meta property="og:url" content="http://mysite.com/appnamespace/object.php?userName=&lt;?php echo $userName; ?&gt;"/&gt;
    &lt;/head&gt;
  </code></pre>
  
  <p>SO, what I need to know is how to send url parameters in the initial call. If I use the debugger and enter something to the effect of <a href="http://mysite.com/appnamespace/object.php?userName=Brad" rel="nofollow noreferrer">http://mysite.com/appnamespace/object.php?userName=Brad</a> everything works fine and the meta tags return content with that name inside of them. However if I try to pass the same url in the Javascript Call, it returns an error saying that my meta property og:type needs to be 'APP_NAMESPACE:object' (which as you see above, is what I have) instead of 'website' (which as you can see above, is something I am not using). Here is what that broken call would look like:</p>
  
  <pre><code>  function postNewAction(userName)
    {
        passString = '&amp;object=http://mysite.com/appnamespace/object.php?userName=' + userName;
  
        FB.api('/me/APP_NAMESPACE:ACTION' + passString,'post',
           function(response) {
                if (!response || response.error) {
                    alert(response.error.message);
                } 
                else {
                    alert('Post was successful! Action ID: ' + response.id);
                } 
            }
        );    
    }
  </code></pre>
  
  <p>To be clear, the userName variable is only for example.</p>
  
  <p>Any thoughts?</p>