无法使用 DocuSign admin API [docusignapi] 更新用户配置文件

Not able to update user profile using DocuSign admin API [docusignapi]

我想更新用户的用户个人资料 (Federated_status),我正在使用 DocuSign 管理员 APi 并从组织管理员帐户生成临时令牌 - 但是当我调用 Docusing 管理员时 api 在下面使用它不会更新它并抛出错误 "unauthorized".

'''try
            {
                HttpContent PostContent = new StringContent(JsonConvert.SerializeObject(ObjUser), Encoding.UTF8, "application/json");
                string reponsebody = string.Empty;
                string Url = "https://api-d.docusign.net/managment/v2/organisation/" + OrgID + "users/profiles";
                using (var client = new HttpClient())
                {

                    client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application / json"));
                    client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", token));
                    HttpResponseMessage rep = client.PostAsync(new System.Uri(Url), PostContent).Result;
                    reponsebody = rep.Content.ReadAsStringAsync().Result;
                }
                var userProfileResponse = JsonConvert.DeserializeObject<UserProfile>(reponsebody);
                return userProfileResponse;
            }



'''

I am not sure how to call this admin api to update user profile - "federated status" .
Please help.!

我怀疑您在获取访问令牌时没有包含正确的范围。对于对 DocuSign 管理员 API 的请求,您必须包括特殊范围。我为每种类型的身份验证提供了一些代码示例。

如果您使用的是 JWT,您的令牌正文将如下所示...

{
  "iss": "5c2b8d7e-xxxx-xxxx-xxxx-cda8a50dd73f",
  "sub": "464f7988-xxxx-xxxx-xxxx-781ee556ab7a",
  "iat": 1523900289,
  "exp": 1523903289,
  "aud": "account-d.docusign.com",
  "scope": "signature organization_read group_read user_read user_write"
}

对于授权代码授予,您的请求必须包括 DocuSign 管理范围,包含在本示例中:

https://account-d.docusign.com/oauth/auth?response_type=code&scope=signature%20organization_read%20group_read%20user_read%20user_write&client_id=7c2b8d7e-xxxx-xxxx-xxxx-cda8a50dd73f&state=a39fh23hnf23&redirect_uri=http://example.com/callback/http://example.com/callback/

对于隐式授权,您的请求将类似,只是响应类型不同

https://account-d.docusign.com/oauth/auth?response_type=token&scope=signature%20organization_read%20group_read%20user_read%20user_write&client_id=7c2b8d7e-xxxx-xxxx-xxxx-cda8a50dd73f&state=a39fh23hnf23&redirect_uri=http://example.com/callback/

有关各种类型范围的更多信息,请参阅我们在 DocuSign Admin API Auth 上的指南。让我知道是否有帮助。

你可以这样做:

GET /v2/organizations/{organizationId}/users/profile

但更新是:

POST /v2/organizations/{organizationId}/users/profiles

不同的端点,我知道这很混乱。

确保你做的是 POST,而不是 GET

https://developers.docusign.com/orgadmin-api/reference/Users/Users/updateUser