Share via


Glossary.CreateCategoriesAsync Method

Definition

Overloads

CreateCategoriesAsync(RequestContent, RequestContext)

[Protocol Method] Create glossary category in bulk.

CreateCategoriesAsync(IEnumerable<AtlasGlossaryCategory>, CancellationToken)

Create glossary category in bulk.

CreateCategoriesAsync(RequestContent, RequestContext)

Source:
Glossary.cs

[Protocol Method] Create glossary category in bulk.

public virtual System.Threading.Tasks.Task<Azure.Response> CreateCategoriesAsync(Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member CreateCategoriesAsync : Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.CreateCategoriesAsync : Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function CreateCategoriesAsync (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 CreateCategoriesAsync and parse the result.

Uri endpoint = new Uri("<endpoint>");
TokenCredential credential = new DefaultAzureCredential();
Glossary client = new DataMapClient(endpoint, credential).GetGlossaryClient();

using RequestContent content = RequestContent.Create(new object[]
{
    new
    {
        name = "ExampleCategory2",
        anchor = new
        {
            glossaryGuid = "c018ddaf-7c21-4b37-a838-dae5f110c3d8",
        },
    },
    new
    {
        name = "ExampleCategory3",
        anchor = new
        {
            glossaryGuid = "c018ddaf-7c21-4b37-a838-dae5f110c3d8",
        },
    }
});
Response response = await client.CreateCategoriesAsync(content);

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result[0].ToString());

Applies to

CreateCategoriesAsync(IEnumerable<AtlasGlossaryCategory>, CancellationToken)

Source:
Glossary.cs

Create glossary category in bulk.

public virtual System.Threading.Tasks.Task<Azure.Response<System.Collections.Generic.IReadOnlyList<Azure.Analytics.Purview.DataMap.AtlasGlossaryCategory>>> CreateCategoriesAsync(System.Collections.Generic.IEnumerable<Azure.Analytics.Purview.DataMap.AtlasGlossaryCategory> body, System.Threading.CancellationToken cancellationToken = default);
abstract member CreateCategoriesAsync : seq<Azure.Analytics.Purview.DataMap.AtlasGlossaryCategory> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<System.Collections.Generic.IReadOnlyList<Azure.Analytics.Purview.DataMap.AtlasGlossaryCategory>>>
override this.CreateCategoriesAsync : seq<Azure.Analytics.Purview.DataMap.AtlasGlossaryCategory> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<System.Collections.Generic.IReadOnlyList<Azure.Analytics.Purview.DataMap.AtlasGlossaryCategory>>>
Public Overridable Function CreateCategoriesAsync (body As IEnumerable(Of AtlasGlossaryCategory), Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of IReadOnlyList(Of AtlasGlossaryCategory)))

Parameters

body
IEnumerable<AtlasGlossaryCategory>

An array of glossary category definitions to be created.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

body is null.

Examples

This sample shows how to call CreateCategoriesAsync.

Uri endpoint = new Uri("<endpoint>");
TokenCredential credential = new DefaultAzureCredential();
Glossary client = new DataMapClient(endpoint, credential).GetGlossaryClient();

Response<IReadOnlyList<AtlasGlossaryCategory>> response = await client.CreateCategoriesAsync(new AtlasGlossaryCategory[]
{
    new AtlasGlossaryCategory
    {
        Name = "ExampleCategory2",
        Anchor = new AtlasGlossaryHeader
        {
            GlossaryGuid = "c018ddaf-7c21-4b37-a838-dae5f110c3d8",
        },
    },
    new AtlasGlossaryCategory
    {
        Name = "ExampleCategory3",
        Anchor = new AtlasGlossaryHeader
        {
            GlossaryGuid = "c018ddaf-7c21-4b37-a838-dae5f110c3d8",
        },
    }
});

Applies to