如何找出 Facebook Graph API 中对象的属性有哪些约束?
例如,事件对象的“标题”的字符限制是多少。或者签到的“地点”属性允许使用哪些数据格式。找不到任何在线文档。
For example what is the character limit of the 'title' of an Event object. Or what data formats are allowed for the 'place' property of a Checkin. Can't find this is any of the online documentation.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你说得对,Facebook API 周围有很多开放领域。字段限制就是其中之一。缺乏字段限制的原因之一可能是 Facebook 管理数据的方式。他们的许多输入字段允许极大的输入,如果它们受到限制的话。尽管如此,这显然并不适用于所有领域,正如您通过使用他们的网站所看到的那样。如果您超出了限制,通常会看到一条非常基本的错误消息。
根据我个人的测试,我发现Event.title的具体限制是75个字符。
至于 place 属性,在“Checkin”对象的发布部分中记录了检查发布的 place 参数是您要执行检查的 PAGE 的 ID。他们最好以与读取对象类似的方式定义发布参数,但由于某种原因他们没有这样做。因此很容易将两者混淆。
对于大多数发布操作,您主要希望查看对象文档底部的发布示例(发布、签入等),然后将它们与上面提供的读取对象的描述进行比较。有时它们是相同的,但就像 Checkin 的情况一样,可能会有差异。
You are right that there are a lot of open areas around the Facebook API. Field limits being one of them. One reason for the lack of field limits may be to the way Facebook manages their data. Many of their input fields allow for extremely large inputs, if they are restricted at all. Although, that obviously does not apply to all fields as you can see by just using their website. If you max out their limit, you will typically be presented with a very basic error message.
From my own personal testing, I have found that the specific limit for the Event.title is 75 characters.
As for the place property, it is documented in the publishing section of the 'Checkin' object that the place parameter for a checking publish is the
ID of the PAGE
to which you are performing a checking. It would be better for them to define the publish parameters in a similar fashion to the read object, but for some reason they did not do so. As a result it is easy to confuse the two.For most publishing operations you mostly want to look at the publishing examples at the bottom of the object documentation (Post, Checkin, etc) and then compare them with the descriptions of the read objects presented above. Sometimes they are the same, but as in the case of Checkin, there can be differences.