LargePersonGroupClient.CreatePersonAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
CreatePersonAsync(RequestContent, RequestContext) |
[Protocol Method] Create a new person in a specified Large Person Group. To add face to this person, please call "Add Large Person Group Person Face".
|
CreatePersonAsync(String, String, CancellationToken) |
Create a new person in a specified Large Person Group. To add face to this person, please call "Add Large Person Group Person Face". |
CreatePersonAsync(RequestContent, RequestContext)
- Source:
- LargePersonGroupClient.cs
[Protocol Method] Create a new person in a specified Large Person Group. To add face to this person, please call "Add Large Person Group Person Face".
- This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
- Please try the simpler CreatePersonAsync(String, String, CancellationToken) convenience overload with strongly typed models first.
public virtual System.Threading.Tasks.Task<Azure.Response> CreatePersonAsync (Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member CreatePersonAsync : Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.CreatePersonAsync : Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function CreatePersonAsync (content As RequestContent, Optional context As RequestContext = Nothing) As Task(Of Response)
Parameters
- content
- RequestContent
The content to send as the body of the request.
- context
- RequestContext
The request context, which can override default behaviors of the client pipeline on a per-call basis.
Returns
The response returned from the service.
Exceptions
content
is null.
Service returned a non-success status code.
Examples
This sample shows how to call CreatePersonAsync and parse the result.
Uri endpoint = new Uri("<endpoint>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
LargePersonGroupClient client = new FaceAdministrationClient(endpoint, credential).GetLargePersonGroupClient("your_large_person_group_id");
using RequestContent content = RequestContent.Create(new
{
name = "your_large_person_group_person_name",
userData = "your_user_data",
});
Response response = await client.CreatePersonAsync(content);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("personId").ToString());
Applies to
CreatePersonAsync(String, String, CancellationToken)
- Source:
- LargePersonGroupClient.cs
Create a new person in a specified Large Person Group. To add face to this person, please call "Add Large Person Group Person Face".
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.AI.Vision.Face.CreatePersonResult>> CreatePersonAsync (string name, string userData = default, System.Threading.CancellationToken cancellationToken = default);
abstract member CreatePersonAsync : string * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.AI.Vision.Face.CreatePersonResult>>
override this.CreatePersonAsync : string * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.AI.Vision.Face.CreatePersonResult>>
Public Overridable Function CreatePersonAsync (name As String, Optional userData As String = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of CreatePersonResult))
Parameters
- name
- String
User defined name, maximum length is 128.
- userData
- String
Optional user defined data. Length should not exceed 16K.
- cancellationToken
- CancellationToken
The cancellation token to use.
Returns
Exceptions
name
is null.
Examples
This sample shows how to call CreatePersonAsync.
Uri endpoint = new Uri("<endpoint>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
LargePersonGroupClient client = new FaceAdministrationClient(endpoint, credential).GetLargePersonGroupClient("your_large_person_group_id");
Response<CreatePersonResult> response = await client.CreatePersonAsync("your_large_person_group_person_name");
Remarks
Please refer to https://learn.microsoft.com/rest/api/face/person-group-operations/create-large-person-group-person for more details.
Applies to
Azure SDK for .NET