当我使用postman应用程序或Graph API资源管理器时,我会获得https://developers.facebook.com/docs/graph-api/reference/v2.0/post
中所述的完整信息或帖子的所有字段我没有在上面的图像中使用fields属性,即使它显示所有字段,所以我正在寻找在查询字符串中传递字段属性的答案。
但是当我使用SDK时,我只获得3个字段created_time,id和message,请参考下图:
请告诉我如何使用facebook sdk c#?
获取帖子的所有字段答案 0 :(得分:1)
您需要指定/me/posts?fields=field1,field2,field3,...
参数,它称为“声明字段”,并附带图API的v2.4:drop function if exists tokens;
delimiter //
create function tokens(instring varchar(255))
returns varchar(255)
begin
declare tempstring varchar(100);
declare outstring varchar(100);
declare checkit int;
set tempstring = ltrim(rtrim(instring));
set checkit = 0;
looper: while tempstring is not null and instr(tempstring,' ') > 0 do
set outstring = substr(tempstring,1,instr(tempstring, ' ') - 1);
set tempstring = ltrim(rtrim(replace(tempstring,outstring,'')));
if length(outstring) = 5 then
if substring(outstring,1,1) between char(48) and char(57) and
substring(outstring,2,1) between char(48) and char(57) and
substring(outstring,3,1) between char(48) and char(57) and
substring(outstring,4,1) between char(48) and char(57) and
substring(outstring,5,1) between char(48) and char(57) then
set checkit = 1;
leave looper;
end if;
end if;
end while;
if checkit = 0 then
set outstring = tempstring;
if length(outstring) = 5 then
if substring(outstring,1,1) between char(48) and char(57) and
substring(outstring,2,1) between char(48) and char(57) and
substring(outstring,3,1) between char(48) and char(57) and
substring(outstring,4,1) between char(48) and char(57) and
substring(outstring,5,1) between char(48) and char(57) then
set checkit = 1;
end if;
end if;
end if;
if checkit = 0 then set outstring = 'NotFound'; end if;
return outstring;
end //
delimiter ;
可以在文档中找到可能的字段,但您应该使用最新版本:https://developers.facebook.com/docs/graph-api/reference/v2.7/post
确保您使用的是较新版本的API,您试图在Postman中使用v1.0(不再存在)。