1

Does anyone know the length of the user ID property in v2.0+ of the graph API? Also is it in fact switching to use non-numeric characters?

In the docs it is now listed as a "string", but no length is given and before v2 of API the ID was a "numeric string":

https://developers.facebook.com/docs/graph-api/reference/v2.2/user

MackelRow
  • 77
  • 1
  • 7

2 Answers2

3

As you said, Facebook states that the id field is in fact defined as string. Currently, the ids are always numeric, but you don't have the guarantee that it will stay like that.

What you wouldn't want I guess is that your app breaks once FB starts using alphanumeric ids. That's why I'd recommend to use variable character data types, for example a VARCHAR(128) if you want to be safe.

See

Community
  • 1
  • 1
Tobi
  • 31,405
  • 8
  • 58
  • 90
  • Cool, that confirms what I was thinking as well. Thanks for the feedback – MackelRow Mar 10 '15 at 11:57
  • Facebook developer docs - dodgy as ever, for example, here https://developers.facebook.com/docs/graph-api/reference/v9.0/user no field lengths can be seen anywhere – joedotnot Jan 26 '21 at 09:34
0

The new, app scoped user IDs are the same length as other IDs in the Facebook API. So if you store them to the database you can keep on storing them as UNSIGNED BIGINT(20) or as a VARCHAR(128), but in the latter case you can run into a performance problems if the database gets big.

Grzegorz Pawlik
  • 2,198
  • 1
  • 18
  • 18
  • Thanks, think i'm going with varchar since there doesn't seem to be a guarantee that it will stay numeric – MackelRow Mar 10 '15 at 11:58
  • 1
    Why exactly will there be performance problems when using VARCHAR? Please elaborate... – Tobi Mar 10 '15 at 13:09