{"id":1444,"date":"2022-08-30T15:16:35","date_gmt":"2022-08-30T15:16:35","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/19\/error-oauthexception-200-when-inviting-to-event-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:16:35","modified_gmt":"2022-08-30T15:16:35","slug":"error-oauthexception-200-when-inviting-to-event-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/error-oauthexception-200-when-inviting-to-event-collection-of-common-programming-errors\/","title":{"rendered":"Error OAuthException: (#200) when inviting to Event-Collection of common programming errors"},"content":{"rendered":"<p>I am getting the Error: Fatal error: Uncaught OAuthException: (#200)<\/p>\n<p>when i try to invite people via an App to an event.<\/p>\n<p>My Steps: 1. Getting long lived token with Permissions: create_event create_note publish_actions publish_stream rsvp_event user_events 2. Getting Userids who are friends and not already invited to the event. 3. Split into 50 Persons per Invite and send it.<\/p>\n<p>Code for Inviting:<\/p>\n<pre><code>$friends = $facebook-&gt;api(array(\n     'method' =&gt; 'fql.query',\n     'query' =&gt; \"SELECT uid,name FROM user WHERE uid IN \n(SELECT uid1 FROM friend WHERE uid2=me()) AND NOT \n(uid IN (SELECT uid FROM event_member where eid = '$eventid'))\"));\n\nforeach ($friends as $value) \n{\n    if (!isset($allids))\n    {\n        $allids = $value['uid'];\n    }\n    else\n    {\n        $allids .= ',' . $value['uid'];\n    }\n    $count++;\n    $invitedusers++;\n    if ($count &gt; 49) \n    {\n    \/\/$splitinvite = $facebook-&gt;api($eventid . '\/invited?users=' . $allids, 'POST');\n    unset($allids);\n    $count = 0;\n    }\n}\n\n$facebook-&gt;api($eventid . '\/invited?users=' . $allids, 'POST');\n<\/code><\/pre>\n<p>I already seperated the Userids to make sure that they are setted correctly in the format Userid_1,Userid_2,Userid_3 I checked the token with the graph token debugger and all permissions are setted correctly. Anyone an idea?<\/p>\n<ol>\n<li>\n<p>One posibility is the following Code. But this works realy slow because it sends a query for each person. It takes up 30 Seconds for checking 37 people. Querying 50 people at once as shown above invites over 1000 people in 30 seconds.<\/p>\n<p><strong>I would appreacheate it if anyone can try to find a better way!!!<\/strong><br \/>\nThe best way would be filtering the FQL query (if is posible).<\/p>\n<p>Slow working Code:<\/p>\n<pre><code>    foreach ($friends as $value) \n    {       \n        try\n        {\n        $splitinvite = $facebook-&gt;api($eventid . '\/invited?user=' . $value['uid'],'POST'); \n        $count++;\n        }\n        catch (Exception $e) \n        {\n\/\/ Users privacy setting blocked inviting him, has blocked you or has blocked you from inviting \n        }\n}\n<\/code><\/pre>\n<\/li>\n<\/ol>\n<p id=\"rop\"><small>Originally posted 2013-11-19 13:16:40. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>I am getting the Error: Fatal error: Uncaught OAuthException: (#200) when i try to invite people via an App to an event. My Steps: 1. Getting long lived token with Permissions: create_event create_note publish_actions publish_stream rsvp_event user_events 2. Getting Userids who are friends and not already invited to the event. 3. Split into 50 Persons [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1444","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1444","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=1444"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1444\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1444"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1444"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1444"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}