Developers were pleased with Thursday’s improvements to Facebook’s Graph API, which allows them to access data in the social graph quicker and easier. Facebook updated field expansion and made a tweak to pagination.
Facebook software engineer Harshdeep Singh announced the changes in the site’s developers blog:
Field expansion significantly improves performance for API calls and reduces your coding effort for retrieving data from the social graph. You can now make advanced Graph API queries to get the exact data you need, in fewer API calls. You can also create nested queries, similar to what you can do with FQL multi-queries. The call response maintains data hierarchy, so you don’t have to post-process the data either.
As an example, you can request read properties from a user’s first K albums and retrieve the first N photos in each album with one API call.
Facebook also made pagination a little easier by introducing cursor-based offset paging for select pages. This indicates when a developer has reached the end or beginning of a data set. The site will no longer show “previous,” or “next,” links when there is no new data. Singh wrote that Facebook is still examining ways to improve pagination.
Readers: If you’re a developer, how will these changes help?