在作为应用程序进行身份验证时添加带有联系人引用的项目时出现问题

Problems adding items with contact references when authenticated as an app

我正在尝试向跑道添加一个项目,其中一个字段的类型是联系人(用户)。

我没有联系人 profile_id,只有名字,所以我需要在添加之前搜索联系人以获得 profile_id。

问题是 /contact/ 资源无法访问,因为我正在使用应用程序身份验证。

错误是:"Authentication as app is not allowed for this method"

推荐的方法是什么?

谢谢。

如我所见,这里棘手的部分是您只有用户名。所以你需要先搜索这个名字

要能够进行搜索,您不应作为应用程序进行身份验证,而应作为具有适当权限的用户进行身份验证。我相信这是因为搜索功能 rate-limited per user. You may authenticate on client side, server side or just by entering user's email and password (see documentation here)。

然后,当通过身份验证时,只需使用带有参数 "ref_type": "profile" 的搜索功能来查找 space, organisation or globally 内的用户名。 PHP-客户端示例:

$attributes = array(
    "query" => "John Doe",
    "ref_type" => "profile"
);
$results = PodioSearchResult::space( $space_id, $attributes ); // search in space
$results = PodioSearchResult::org( $org_id, $attributes ); // search in organisation
$results = PodioSearchResult::search( $attributes ); // search globally

上面的函数将 return 找到最相关结果的数组。在那里您可以获得用户 ID 和其他用户信息。

请注意从技术上讲,多个不同的用户可能具有相同的名称,因此找到的结果可能不止一个。您将以某种方式选择其中之一。