Share via


Glossary.CreateCategory Method

Definition

Overloads

CreateCategory(AtlasGlossaryCategory, CancellationToken)

Create a glossary category.

CreateCategory(RequestContent, RequestContext)

[Protocol Method] Create a glossary category.

CreateCategory(AtlasGlossaryCategory, CancellationToken)

Source:
Glossary.cs

Create a glossary category.

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

Parameters

body
AtlasGlossaryCategory

Body parameter.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

body is null.

Examples

This sample shows how to call CreateCategory.

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

AtlasGlossaryCategory body = new AtlasGlossaryCategory
{
    Name = "ExampleCategory1",
    Anchor = new AtlasGlossaryHeader
    {
        GlossaryGuid = "c018ddaf-7c21-4b37-a838-dae5f110c3d8",
    },
    Terms = {new AtlasRelatedTermHeader
    {
        TermGuid = "54688d39-b298-4104-9e80-f2a16f44aaea",
    }},
};
Response<AtlasGlossaryCategory> response = client.CreateCategory(body);

Applies to

CreateCategory(RequestContent, RequestContext)

Source:
Glossary.cs

[Protocol Method] Create a glossary category.

public virtual Azure.Response CreateCategory(Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member CreateCategory : Azure.Core.RequestContent * Azure.RequestContext -> Azure.Response
override this.CreateCategory : Azure.Core.RequestContent * Azure.RequestContext -> Azure.Response
Public Overridable Function CreateCategory (content As RequestContent, Optional context As RequestContext = Nothing) As 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 CreateCategory 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
{
    anchor = new
    {
        glossaryGuid = "c018ddaf-7c21-4b37-a838-dae5f110c3d8",
    },
    name = "ExampleCategory1",
    terms = new object[]
    {
        new
        {
            termGuid = "54688d39-b298-4104-9e80-f2a16f44aaea",
        }
    },
});
Response response = client.CreateCategory(content);

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

Applies to