v2.12版本自上周起无法获取活动的owner及updated_time字段问题
owner and updated_time Hey there, sounds like you hit a frustrating silent API change starting around April 12th that's messing with your /me/events requests. Let's break down what's happening and how to work around it.
The Problem Recap
- Before ~April 12th, your original request pulled up to 500 upcoming events without issues:
$fb->get('/me/events?limit=500&since=now&fields=picture,name,description,cover,owner,end_time,start_time,updated_time,timezone,interested_count,place,type', $me->Get('token')); - Now, if you include
ownerandupdated_timein your fields list, the endpoint only returns 1 event instead of your full list. - Remove those two fields, and everything works as expected again.
Why This Might Be Happening
Facebook frequently rolls out unannounced changes to their Graph API, often around field permissions or parameter handling. My guess is either:
- There's a new restriction on bulk-fetching the
ownerfield for events, or - A bug in how the API combines
owner/updated_timewith yoursince=nowandlimit=500parameters.
Workarounds to Get Your Full Data
Split Your Requests
The most reliable fix right now is to split your call into two parts:- First, fetch the core event data without
ownerandupdated_time:$eventsResponse = $fb->get('/me/events?limit=500&since=now&fields=picture,name,description,cover,end_time,start_time,timezone,interested_count,place,type', $me->Get('token')); $events = $eventsResponse->getGraphEdge(); - Then, loop through each event and fetch the missing fields individually:
foreach ($events as $event) { $detailsResponse = $fb->get("/{$event['id']}?fields=owner,updated_time", $me->Get('token')); $eventDetails = $detailsResponse->getGraphNode(); // Merge $eventDetails into your original event object here }
Just keep an eye on Graph API rate limits—you don't want to get throttled if you're fetching 500 events individually.
- First, fetch the core event data without
Double-Check Your Permissions
Make sure your access token still has theuser_eventspermission. Recent changes might have tightened access to theownerfield, so verifying your token's scopes could help rule out permission issues.Report the Bug to Facebook
This feels like an unintended breaking change, so reporting it through Facebook's Developer Support will help their team fix it faster if it's a bug.
Wrap-Up
Until Facebook addresses this directly, splitting your requests is the best way to get all the event data you need for your site. Just make sure to handle any rate limits gracefully in your code.
内容的提问来源于stack exchange,提问作者Alain Zelink

