Versioning
Not all APIs and SDKs share the same versioning system. For example, the Graph API is versioned with a different pace and numbering compared to the iOS SDK. All SDKs released after 30th April 2014 support the ability to interact with different versions of our APIs. Multiple versions of APIs or SDKs can exist at the same time with different functionality in each version.
Why do we have versions?
The goal for having versioning is for developers building apps to be able to understand in advance when an API or SDK might change. They help with web development, but are critical with mobile development because a person using your app on their phone may take a long time to upgrade (or may never upgrade).
As mentioned, each version will remain for at least 2 years from release, therefore giving you a solid timeline for how long your app will remain working, and for how long you have to update it to newer versions.
Version Schedules
Each version is guaranteed to operate for at least two years. A version will no longer be usable two years after the date that the subsequent version is released.
So if API version 2.3 is released on March 25th, 2015 and API version 2.4 is released August 7th, 2015 then v2.3 would expire on August 7th, 2017, two years after the release of v2.4.
For APIs, once a version is no longer usable, any calls made to it will be defaulted to the next oldest usable version. Here's a timeline example:
For SDKs, a version will always remain available as it is a downloadable package, however beyond it's end-of-life date, it may rely upon APIs or methods which no longer work, so you should assume an end-of-life SDK is no longer functional.
You can find specific info about our version timelines, changes, and release dates on our changelog page.
Will everything core remain completely unchanged in a version?
Facebook does reserve the right to make changes in any API in a short period of time for issues related to security or privacy. These changes don't happen often, but they do happen.
What happens if I don't specify a version for an API?
We refer to this as an unversioned call. An unversioned call will default to the oldest available version of the API. Consider this hypothetical life cycle of API versions:
An unversioned call will always point to the oldest version still available at the top of the chart. This is currently v2.0, but after two years it'll be v2.1, then v2.2, etc.
Because of this, our recommendation is to always specify versions when making calls, where possible.
Can my app make calls to versions older than the current version?
An app can make calls to the version of the API that was the latest available when the app was created, as well as any newer, un-deprecated versions launched after the app is created.
As an example, if your app was created after v2.0 was released, it will be able to make calls to v2.0 until the expiration date of that version, and any subsequent versions (v2.1 etc) until their expiration dates.
If an app is created and isn't used to make any calls or requests before a new version is released, it will not have the ability to use older versions. Here's an example to explain this:
- If your app was created while v2.0 was the latest version available, but not used until after v2.1 had launched, it will only be to use v2.1, and not v2.0.
- If your app was created while v2.0 was the latest version available, and then used before v2.1 had launched, it will still be able to use v2.0 even after the launch of v2.1.
Marketing API Versioning
The Marketing API has its own versioning scheme. Both version numbers and their schedules are different from the Graph API's state of things.
Learn more about Marketing API VersioningMaking Versioned Requests
Graph API
Whether core or extended, almost all Graph API endpoints are available through a versioned path. We've afull guide to using versions with the Graph API in our Graph API quickstart guide.
Dialogs
Versioned paths aren't just true for API endpoints, they're also true for dialogs and social plugins. For example, if you want to generate the Facebook Login dialog for a web app, you can prepend a version number to the endpoint that generates the dialog:
https://www.facebook.com/v2.1/dialog/oauth? client_id={app-id}&redirect_uri={redirect-uri}
Social Plugins
If you're using the HTML5 or xfbml versions of our social plugins, the version rendered will be determined by the version specified when you're initialising the JavaScript SDK.
If you're inserting an iframe or plain link version of one of our plugins, you'd prepend the version number to the source path of the plugin:
<iframesrc="//www.facebook.com/v2.1/plugins/like.php?href=https%3A%2F%2Fdevelopers.facebook.com%2Fdocs%2Fplugins%2F&amp;width&amp;layout=standard&amp;action=like&amp;show_faces=true&amp;share=true&amp;height=80&amp;appId=634262946633418"scrolling="no"frameborder="0"style="border:none; overflow:hidden; height:80px;"allowTransparency="true"></iframe>
Making Versioned Requests from SDKs
If you're using the Facebook SDK for iOS, Android or JavaScript, making versioning calls is largely automatic. Note that this is distinct from each SDKs own versioning system.
JavaScript
The JavaScript SDK can only use different API versions if you're using the sdk.js
path.
If you're using FB.init()
from the JavaScript SDK, you need to use the version parameter, like this:
FB.init({ appId :'{app-id}', version :'v2.0'});
If you set the version flag in the init, then any calls to FB.api()
will automatically have the version prepended to the path that's called. The same is true for any dialogs for Facebook Login that happen to get called. You will get the Facebook Login dialog for that version of the API.
If you need to, you can override a version by just prepending the version to the path of the endpoint in theFB.api()
call.
iOS
Each version of the iOS SDK that's released is tied to the version that's available on the date of release. This means that if you're upgrading to a new SDK you're also upgrading to the latest API version as well (although you can manually specify any earlier, available API version with [FBSDKGraphRequest initWithGraphPath]
). The API version is listed with the release of each version of the iOS SDK.
Much like the JavaScript SDK, the version is prepended to any calls you make to the graph API though the iOS SDK. For example, if v2.2 was the most recent version of the API, this call will actually call /v2.2/me
:
[[[FBSDKGraphRequest alloc] initWithGraphPath:@"me/friends" parameters:@{@"fields":@"cover,name,start_time"}] startWithCompletionHandler:^(FBSDKGraphRequestConnection*connection, id result,NSError*error){(...)}];
You can override the version of the call with [FBSDKGraphRequestConnection overrideVersionPartWith]
.
Android
Each version of the Android SDK that's released is tied to the version that's available on the date of release. This means that if you're upgrading to a new SDK you're also upgrading to the latest API version as well (although you can manually specify any earlier, available API version withRequest.setVersion()
). The API version is listed with the release of each version of the Android SDK.
Much like the JavaScript SDK, the version is prepended to any calls you make to the graph API though the Android SDK. For example, if v2.2 was the most recent version of the API, this call will actually call /v2.2/me:
Request request =newRequest(session,"me/events?fields=cover,name,start_time"); request.executeAsync();
You can override the version of the call with Request.setVersion()
.
Migrations
Migrations are changes to the extended elements of Facebook Platform which can introduce new behaviors, and therefore breaking changes.
Migrations that are currently still in progress are listed on our Platform roadmap. Migrations have at least a 90-day window during which you must migrate your app. Once a window begins, the post-migration behavior will become the default for new apps. Then, when the migration window is completed, the pre-migration behavior will no longer be available at all.
You can find info about completed migrations in a separate section of our roadmap.
Managing Migrations via Graph API
Migrations can be managed via the migrations field in the /app
node:
You can make an update call on the edge to activate and deactivate migrations.
Managing Migrations via App Dashboard
You can activate and deactivate available migrations in the App Dashboard under Settings > Migrations:
Temporary Client-side Activation of Migrations
Instead of activating the migration in your App dashboard, or via the API, it's possible to instead add a special flag to your API calls that sets the migration. The flag is called migrations_override
and requires you to specify a JSON blob that describes what migrations you want to turn on or off. For example, if you were making a raw call you could pass:
http://graph.facebook.com/path? migrations_override={"migration1":true,"migration2":false}
Using this, you can call the new API through client updates instead of having to get all callers to update to calling the new API at the same time. It's also very useful for debugging.
The names for these migrations are found on the /app
node mentioned above.
相关推荐
这款模板旨在帮助用户以清晰、直观的方式呈现与Facebook平台交互的应用程序、接口设计以及跨文化交流的合作策略。在欧美市场背景下,它能够有效地传达企业对于科技与创新的追求,提升品牌形象。 在【描述】中提到了...
在Facebook的SDN实践中,他们还引入了“OCP”(Open Compute Project)的硬件设计,这是一项旨在推动数据中心硬件标准化和开放化的倡议。通过OCP,Facebook与其他公司共享其数据中心硬件设计,鼓励行业创新并降低...
描述中提到的“帮助学习和了解facebook”,暗示了这些资料可能包含了如何利用Facebook进行开发、如何构建与Facebook平台集成的应用程序,以及在2008年时Facebook的功能特性和使用策略。对于想要深入了解Facebook历史...
在IT行业中,Facebook开放平台(fb_open_platform)是开发者们构建和扩展Facebook功能的重要工具集。这个平台允许开发者使用各种编程语言,如Python、JavaScript、Java等,来创建社交应用程序,增强用户在Facebook上...
4. **FQL(Facebook Query Language)**:虽然FQL在新版本的API中逐渐被弃用,但在旧项目中仍然可能遇到。它是一种类似于SQL的语言,用于查询Facebook的社交图谱数据。 5. **Social Plugins**:Facebook提供了多种...
10. **版本控制策略**:学习如何制定和实施版本控制策略,如主分支开发模式或者GitFlow等。 通过艾米的项目,我们可以看到一个新手开发者如何逐步成长,从零基础到能够独立贡献并参与到复杂的开源项目中去。这为...
Keras是一个高级神经网络API,可运行于TensorFlow、Theano和CNTK等后端。它以简洁、模块化和用户友好的方式设计,使得构建和训练深度学习模型变得简单。在本项目中,Keras被用来实现RetinaNet模型,允许快速实验和...
这个压缩包文件"PacktPub.Funambol.Mobile.Open.source.Dec.2009.rar"包含了2009年12月出版的《Funambol:移动开源同步解决方案》的电子版,文件名为"PacktPub.Funambol.Mobile.Open.source.Dec.2009.pdf"。...
例如,Facebook有Open Graph API,Twitter有Share Tweet Intent,LinkedIn有Share API。 4. **URL编码**:在构造分享链接时,确保所有URL和参数都被正确地编码,以避免特殊字符导致的问题。 5. **跨域问题**:如果...
ONNXRuntime是微软和Facebook共同维护的一个高性能的推理引擎,它可以运行多种机器学习框架导出的ONNX(Open Neural Network Exchange)模型。ONNX是一种开放格式,用于表示训练好的机器学习模型,旨在提高不同框架...
它通过在后台与服务器进行少量数据交换,使网页实现异步更新,提升了用户体验,尤其是在网页应用中,比如谷歌地图、Facebook动态等。本教程及帮助文档将深入讲解Ajax的核心概念和技术细节。** **一、Ajax基础** ...
PyTorch则是Facebook的AI研究团队开发的,以其灵活性和易用性著称,适合快速原型设计。Keras则是一个高级神经网络API,可以在TensorFlow、Theano和CNTK后端上运行,简化了深度学习模型的构建过程。 在深度强化学习...
2. 社交网络开放平台:如Facebook的Open Graph,允许开发者创建社交插件和应用,使用户能在社交网络上分享和互动。 3. 数据开放平台:提供公共数据集,如政府公开数据,供研究者和开发者使用。 4. 云服务平台:如AWS...
React Native是由Facebook开发的开源框架,它允许开发者使用JavaScript和React来构建原生移动应用程序。RN的核心理念是“Learn once, write anywhere”,即学习一套API和概念,就能在iOS和Android平台上进行开发。...
此外,社交网络和Web服务API(如Facebook的Open Graph API或Twitter的RESTful API)可能也是本书的重点。开发者将了解到如何构建可以集成到社交平台的应用,实现用户数据的分享和互动。 Web 2.0还涉及数据存储和...
React 是一个由Facebook开发的JavaScript库,用于构建用户界面,特别是单页应用程序。它允许开发人员创建可重用的组件,提高代码的组织性和效率。JavaScript是网页开发中的主要脚本语言,用于实现页面的交互性和动态...
9. **API集成**:如果模板支持社交媒体分享或其他第三方服务集成,那么可能使用了API接口,如Facebook的Open Graph或Twitter的卡。 10. **SEO优化**:考虑到搜索引擎的友好性,模板可能内置了SEO优化元素,如元标签...
例如,Facebook、Twitter和微信等都属于开放平台,开发者可以利用这些平台的API开发社交应用、小游戏或其他服务。 在这个压缩包中,我们可以期待找到以下几类资料: 1. **MP平台详解**:这部分可能包含了MP平台的...
"open-source-covid-vis"是一个专为Hack the Planet 2021活动设计的项目,其目标是将全球开放源码的数据转化为易于理解的COVID-19疫情图表和地图,帮助公众更好地跟踪和理解这场全球大流行的演变。 项目的核心技术...