命名空间:microsoft.graph
重要
Microsoft Graph版本下的 /beta API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。
更新b2cIdentityUserFlow中的apiConnectorConfiguration属性,以在用户流中启用或禁用 API 连接器。 apiConnectorConfiguration的每个关系对应于用户流中可配置为调用 API 连接器的特定步骤。 一次为特定步骤 1 配置 API 连接器,如下所示。
权限
要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息,请参阅权限。
| 权限类型 |
权限(从最低特权到最高特权) |
| 委派(工作或学校帐户) |
IdentityUserFlow.ReadWrite.All |
| 委派(个人 Microsoft 帐户) |
不支持 |
| 应用程序 |
IdentityUserFlow.ReadWrite.All |
工作或学校帐户需要属于以下角色之一:
HTTP 请求
PUT /identity/b2cUserFlows/{b2cUserFlowId}/apiConnectorConfiguration/{step}/$ref
| 名称 |
说明 |
| Authorization |
Bearer {token}。必需。 |
| Content-Type |
application/json. Required. |
请求正文
在请求正文中,提供要使用特定步骤的 id identityApiConnector 的 JSON 表示形式。 若要禁用 API 连接器,值可以是 {} 。
响应
如果成功,此方法返回 204 No Content 响应代码。
示例
示例 1:在注册时为 IDP 后联合身份验证启用 API 连接器
请求
下面展示了示例请求。
PUT https://graph.microsoft.com/beta/identity/b2cUserFlows/B2C_1_testuserflow/apiConnectorConfiguration/postFederationSignup/$ref
Content-Type: application/json
{
"@odata.id": "https://graph.microsoft.com/beta/identity/apiConnectors/{id}"
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
await graphClient.Identity.B2cUserFlows["{b2cIdentityUserFlow-id}"].PostFederationSignup.Reference
.Request()
.PutAsync("{id}");
const options = {
authProvider,
};
const client = Client.init(options);
const identityApiConnector = {
'@odata.id': 'https://graph.microsoft.com/beta/identity/apiConnectors/{id}'
};
await client.api('/identity/b2cUserFlows/B2C_1_testuserflow/apiConnectorConfiguration/postFederationSignup/$ref')
.version('beta')
.put(identityApiConnector);
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/beta/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/identity/b2cUserFlows/B2C_1_testuserflow/apiConnectorConfiguration/postFederationSignup/$ref"]]];
[urlRequest setHTTPMethod:@"PUT"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
MSGraphIdentityApiConnector *identityApiConnector = [[MSGraphIdentityApiConnector alloc] init];
NSError *error;
NSData *identityApiConnectorData = [identityApiConnector getSerializedDataWithError:&error];
[urlRequest setHTTPBody:identityApiConnectorData];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
IdentityApiConnector identityApiConnector = new IdentityApiConnector();
identityApiConnector.additionalDataManager().put("@odata.id", new JsonPrimitive("https://graph.microsoft.com/beta/identity/apiConnectors/{id}"));
graphClient.identity().b2cUserFlows("B2C_1_testuserflow").postFederationSignup().reference()
.buildRequest()
.put(identityApiConnector);
响应
下面介绍响应示例。
HTTP/1.1 204 No Content
示例 2:在注册时为 Post 属性集合启用 API 连接器
请求
下面展示了示例请求。
PUT https://graph.microsoft.com/beta/identity/b2cUserFlows/B2C_1_testuserflow/apiConnectorConfiguration/postAttributeCollection/$ref
Content-Type: application/json
{
"@odata.id": "https://graph.microsoft.com/beta/identity/apiConnectors/{id}"
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
await graphClient.Identity.B2cUserFlows["{b2cIdentityUserFlow-id}"].PostAttributeCollection.Reference
.Request()
.PutAsync("{id}");
const options = {
authProvider,
};
const client = Client.init(options);
const identityApiConnector = {
'@odata.id': 'https://graph.microsoft.com/beta/identity/apiConnectors/{id}'
};
await client.api('/identity/b2cUserFlows/B2C_1_testuserflow/apiConnectorConfiguration/postAttributeCollection/$ref')
.version('beta')
.put(identityApiConnector);
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/beta/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/identity/b2cUserFlows/B2C_1_testuserflow/apiConnectorConfiguration/postAttributeCollection/$ref"]]];
[urlRequest setHTTPMethod:@"PUT"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
MSGraphIdentityApiConnector *identityApiConnector = [[MSGraphIdentityApiConnector alloc] init];
NSError *error;
NSData *identityApiConnectorData = [identityApiConnector getSerializedDataWithError:&error];
[urlRequest setHTTPBody:identityApiConnectorData];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
IdentityApiConnector identityApiConnector = new IdentityApiConnector();
identityApiConnector.additionalDataManager().put("@odata.id", new JsonPrimitive("https://graph.microsoft.com/beta/identity/apiConnectors/{id}"));
graphClient.identity().b2cUserFlows("B2C_1_testuserflow").postAttributeCollection().reference()
.buildRequest()
.put(identityApiConnector);
响应
下面介绍响应示例。
HTTP/1.1 204 No Content
示例 3:在注册时禁用 Post 属性集合的 API 连接器
请求
下面展示了示例请求。
PUT https://graph.microsoft.com/beta/identity/b2cUserFlows/B2C_1_testuserflow/apiConnectorConfiguration/postAttributeCollection/$ref
Content-Type: application/json
{ }
const options = {
authProvider,
};
const client = Client.init(options);
const identityApiConnector = { };
await client.api('/identity/b2cUserFlows/B2C_1_testuserflow/apiConnectorConfiguration/postAttributeCollection/$ref')
.version('beta')
.put(identityApiConnector);
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/beta/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/identity/b2cUserFlows/B2C_1_testuserflow/apiConnectorConfiguration/postAttributeCollection/$ref"]]];
[urlRequest setHTTPMethod:@"PUT"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
MSGraphIdentityApiConnector *identityApiConnector = [[MSGraphIdentityApiConnector alloc] init];
NSError *error;
NSData *identityApiConnectorData = [identityApiConnector getSerializedDataWithError:&error];
[urlRequest setHTTPBody:identityApiConnectorData];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
IdentityApiConnector identityApiConnector = new IdentityApiConnector();
graphClient.identity().b2cUserFlows("B2C_1_testuserflow").postAttributeCollection().reference()
.buildRequest()
.put(identityApiConnector);
响应
下面展示了示例响应。
HTTP/1.1 204 No Content