UserRequestsClient.SubmitAsync(RequestContent, RequestContext) Method

Definition

[Protocol Method] Submit a user request for requestor, a user request describes user ask to do operation(s) on Purview. If any workflow's trigger matches with an operation in request, a run of the workflow is created.

  • This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
public virtual System.Threading.Tasks.Task<Azure.Response> SubmitAsync (Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member SubmitAsync : Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.SubmitAsync : Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function SubmitAsync (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 SubmitAsync and parse the result.

Uri endpoint = new Uri("<endpoint>");
TokenCredential credential = new DefaultAzureCredential();
UserRequestsClient client = new UserRequestsClient(endpoint, credential);

using RequestContent content = RequestContent.Create(new
{
    operations = new object[]
    {
        new
        {
            type = "CreateTerm",
            payload = new object(),
        }
    },
});
Response response = await client.SubmitAsync(content);

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("requestId").ToString());
Console.WriteLine(result.GetProperty("requestor").ToString());
Console.WriteLine(result.GetProperty("operations")[0].GetProperty("type").ToString());
Console.WriteLine(result.GetProperty("operations")[0].GetProperty("payload").ToString());
Console.WriteLine(result.GetProperty("status").ToString());

This sample shows how to call SubmitAsync with all request content and parse the result.

Uri endpoint = new Uri("<endpoint>");
TokenCredential credential = new DefaultAzureCredential();
UserRequestsClient client = new UserRequestsClient(endpoint, credential);

using RequestContent content = RequestContent.Create(new
{
    operations = new object[]
    {
        new
        {
            type = "CreateTerm",
            payload = new object(),
        }
    },
    comment = "<comment>",
});
Response response = await client.SubmitAsync(content);

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("requestId").ToString());
Console.WriteLine(result.GetProperty("requestor").ToString());
Console.WriteLine(result.GetProperty("operations")[0].GetProperty("type").ToString());
Console.WriteLine(result.GetProperty("operations")[0].GetProperty("payload").ToString());
Console.WriteLine(result.GetProperty("operations")[0].GetProperty("workflowRunIds")[0].ToString());
Console.WriteLine(result.GetProperty("comment").ToString());
Console.WriteLine(result.GetProperty("status").ToString());

Applies to