Facebook API ver1.0はいつまで使える?新規作成アプリでも使える?

[ スポンサーリンク ]

fbapiv2
Facebook API ver1.0は、2014/4/30以降に作成されたアプリでは使えません。
例え、明示的に「version : ‘v1.0’」と指定したとしても、使えませんでした。
(正確には、v1.0で呼び出されているものの、挙動としてはv2.0と同じになっていました。)

逆に、2014/4/30よりも前に作成したアプリでは、バージョンの指定が無いとv1.0が呼び出され、挙動もちゃんとv1.0です。
明示的に「version : ‘v2.0’」と指定すれば、v2.0が呼び出されます。
fbapiv2
Facebook api ver1.0 can not use by the app that was created after 2014-4-30.
Even if you specify that use api version is v1.0 when calling api, you could not use that.
(To be exact, api is called as v1.0, but that api’s behavior is same as v2.0.)

On the other hand, on the app that was created before 2014-4-30, api is called as v1.0, and that api’s behavior is exactly v1.0.
And if you specify that use api version is v2.0 when calling api, you can use v2.0 api.

なぜ2014/4/30の前後で異なるのか?

2014/4/30に、「f8」と呼ばれるFacebookのデベロッパー向けのカンファレンスが開催されました。
その際に、APIにバージョン管理が導入されることや、その移行スケジュール等が発表になっています。

下記のブログに非常に詳しくまとまっていますので、是非ご一読を。

f8 2014 の発表: API バージョニングと注意点 : Facebook開発者向けドキュメントの日本語訳とTips
http://facebook-docs.oklahome.net/archives/52156714.html

この「f8」当日にAPIのバージョン2.0がリリースされたことにより、旧バージョンにあたるv1.0はここから1年間(2015/4/30まで)の保証となりました。

v1.0とv2.0で違う点は?

色々と異なる点は多いのですが、特に大きなものが、アプリのパーミッション周りの変更です。
下記の記事も参考にしてください。

Facebookログイン Version2.0(アプリのパーミッション仕様変更)
https://snowadays.jp/2014/05/2762

読み取りの権限が最低限のものを除き申請しないと使えなくなったことに加えて、投稿の権限に関しては申請必須なだけでなく、scope自体も変わっています。
(「publish_stream」「photo_upload」というパーミッションが廃止され、「publish_actions」に統合)

2014/4/30以降に作ったアプリでは、APIバージョン1.0は本当に使えない?

冒頭でも書きましたが、ダメでした。
(むしろ、出来るなら教えてほしいです・・・)

お馴染みのStack Overflow初めとして色々と情報を漁ってみましたが、出来ないという情報しかありません。
一応自分でも試してみました。

	FB.init({
		appId   : '{app-id}',
		xfbml   : true,
		version : 'v1.0',
		status  : true,
		cookie  : true,
		oauth   : true
	});

こんな感じで、FB.init内でバージョンの指定が出来るんですね。
で、こうしたうえで、{app-id}に4/30以降に作成したアプリのIDを指定して、それでもってFB.loginのscopeで「publish_stream」を指定します。
もし、バージョン1.0のAPIが使えるなら、これでウォールへの投稿が出来るはず。
(バージョン1.0では、publish_streamの申請は不要でした。)

デモページ

↑実際にそれで作ってみました。指定してるアプリは4/30以降に作成したアプリです。結果、ダメでした。
ログインのダイアログが開く際には、GETでv1.0とわたってるのでちょっと期待したんですが、結局挙動としてはv2.0と同じ。
当然、バージョン2.0では「publish_stream」は廃止されているので、ウォールへの投稿はされません。

※デモページのログインボタンをクリックするとFacebookアカウントでのログイン、及びアプリの承認が走ります。
※クリックしてもウォールへの投稿はされませんが、万が一投稿されてしまった場合は「Hello World」という投稿が行われますので、ご自分で削除してくださいw

ということで、結局のところもうバージョン2.0への移行を始めなければなりません。
パーミッション(特にpublish_actions)の申請周りについては、以下の記事を参考にしてみてください。

Facebookアプリのパーミッション「publish_actions」を申請してみてわかったことまとめ
https://snowadays.jp/2014/06/2790

Facebookアプリのテストユーザーを利用してpublish_actions等を審査前に動作確認する
https://snowadays.jp/2014/06/2851

Why it was changed at before 2014-4-30 and after?

Facebook hosted the conference for developers at 2014-4-30. That is called “f8”.
They announced the version management for api, and that migration schedule at the “f8”.

Please check the following post, this blog is summarizing “f8” in detail very well.

f8 2014 の発表: API バージョニングと注意点 : Facebook開発者向けドキュメントの日本語訳とTips
http://facebook-docs.oklahome.net/archives/52156714.html

The api version1.0(that is the old version.) is supported for 1 year from the day of “f8”, because the api verion2.0(that is the new version.) was released at the “f8”.

What is the difference between v1.0 and v2.0 ?

There are various difference. Above all, the changes about app’s permissions are especially important.
These changes are described in the following post, please also check this.

Facebookログイン Version2.0(アプリのパーミッション仕様変更)
https://snowadays.jp/2014/05/2762

In these changes, if your app need to use some permissions(except some permissions), you need submit review about the app’s permission to facebook, and that is approved.
Both of reading permission and writing permission cannot use unless review is approved.
And scope name was changed at writing permission.
(The scopes named “publish_stream” and “photo_upload” were abolished, unite into new scope named “publish_actions”.)

Is it true that the api version 1.0 cannot use by the app that was created after 2014-4-30 ?

As i wrote the beginning, it is true.
(If you know how to do, please tell me.)

I was looking for some information about this(at Stack Overflow, etc), but could not find that.

So, I tried by myself once.

	FB.init({
		appId   : '{app-id}',
		xfbml   : true,
		version : 'v1.0',
		status  : true,
		cookie  : true,
		oauth   : true
	});

As above, you can set api version to “v1.0” at “version” param in “FB.init”.
Then, set “{app-id}” to app’s id(that app was created after 4-30.), and set scope to “publish_stream” permission in “FB.login”.
It might be able to post to wall, if you can use api version 1.0.

Demo Page

↑This is demo page.

App id that is set was created after 4-30.
As result, it could not work.
When FB.login dialog was opened, it seemed that version was called as “v1.0” by GET param, but that behavior was same as “v2.0”.
Of course, you can not post to wall anything by demo page, because “publish_stream” permission can not use by api “v2.0”.

*When you click the login button at demo page, you go to the Facebook login, and app’s permission dialog will open.
*Even if you were to approve the permission, nothing would be posted to wall.If it should be posted, the “Hello World” message would be posted to your wall. so please delete that by yourself.

Therefore, we need to start migration to version 2.0.
Please also check the following posts , that is described about the review of app’s permission(especially publish_actions) to facebook team.

Facebookアプリのパーミッション「publish_actions」を申請してみてわかったことまとめ
https://snowadays.jp/2014/06/2790

Facebookアプリのテストユーザーを利用してpublish_actions等を審査前に動作確認する
https://snowadays.jp/2014/06/2851

タイトルとURLをコピーしました