类型字符串是预期的,但收到了一个值为 0 的整数类型

The type string is expected but a type integer was received with value 0

我正在研究营销 API。我想点击这个 Api 来估计目标受众,基本上有多少用户能够看到我的广告。

 "https://graph.facebook.com/v2.2/{adaccountid}/reachestimate"

在传递此参数之前,我一直在收到响应 "flexible_spec"。每当我传递此参数时,我都会收到此响应 "The type string is expected but a type integer was received with value 0"。我搜索了它,但没有解决方案。

我将向您展示我到目前为止所做的尝试:

 1)"https://graph.facebook.com/v2.2//{adaccountid}/reachestimate?     targeting_spec={"geo_locations":{"countries":   ["IN"]},"flexible_spec":{"interests":["6006289279425"]}}
 2) "https://graph.facebook.com/v2.2//{adaccountid}/reachestimate?     targeting_spec={"geo_locations":{"countries":   ["IN"]},"flexible_spec":{"interests":["Movies"]}} 
 3)"https://graph.facebook.com/v2.2//{adaccountid}/reachestimate?     targeting_spec={"geo_locations":{"countries":   ["IN"]},"flexible_spec":{"interests":["id":"6006289279425","name":"Movies"]}}

我试过在灵活的规范兴趣中发送一个 id 数组,在 flexible_spec 兴趣中发送一个名称数组,我还尝试在其中发送 list<interests>。但是运气不好。

我搜索了很多有关此错误的信息。然后我开始知道我在这个 API 中犯的错误。我们可以指定两种类型的兴趣字段:

 1) targeting_spec={"geo_locations":{"countries":"IN"]},"flexible_spec":[{"interests":["6006289279425"]}]}
 2) targeting_spec={"geo_locations":{"countries":   ["IN"]},"interests":["6006289279425","46345343534"]}

flexible_spec 数组中的第一个传递兴趣数组。 第二个将兴趣作为数组对象传递,但不在 flexible_spec.

这对我有帮助。我发布这个答案是因为在同样的情况下它也可能对你有帮助。 谢谢