Perceptive Content Integration API - Add Document to Workflow Queue

This article demonstrates one way a custom application can add a document to a workflow queue with the Integration Server API. Always open a session before calling the Integration API and close it afterwards ( This example comes from an asynchronous .Net WebAPI written in C#.

Add a document or folder to workflow queue

Add to Workflow Queue Documentation

/// <summary>
/// Adds the document or folder to a workflow
/// Example POST payload json:
///    {
///        "objectId": "301YW2G_0006YVLZ1000011",
///        "itemType": "DOCUMENT",
///        "workflowQueueId": "301YW2G_0006YMLZ100001R",
///        "itemPriority": "MEDIUM"
///    }
/// </summary>
/// <param name="objectID">ID of Document or Folder being added</param>
/// <param name="workflowQueueID">ID of the target workflow</param>
public static async Task<string> AddWorkflowQueueItem(string objectID, string workflowQueueID)
    // Create POST JSON data   
    var postData = "{\"objectId\": \"" + objectID + "\",\"itemType\": \"DOCUMENT\",\"workflowQueueId\": \"" + workflowQueueID + "\",\"itemPriority\": \"MEDIUM\"}";

    //send the POST request with assignment data
    var retval = await PostRequest(BaseURL + "workflowItem/", postData);

    return retval;

/// <summary>
/// Helper for making a POST request to Integration Server API
/// </summary>
/// <param name="url">URL for this request</param>
/// <param name="postData">Data payload for this request, defaults to empty string</param>
private static async Task<string> PostRequest(string url, string postData = "") //post data defaults to null
        //http client data persists so first we clear headers

        //API will default to returning XML if we do not 
        //specify the Accept header
            new MediaTypeWithQualityHeaderValue("application/json"));

        //Retrieve the access token from memory and 
        //add it to the request as a custom header
        client.DefaultRequestHeaders.Add("X-IntegrationServer-Session-Hash", Token);

        //This line adds the post data and sets the content-type 
        //header to application/json
        var data = new StringContent(postData, Encoding.UTF8, "application/json");

        //Send the POST2 request
        HttpResponseMessage response = await client.PostAsync(url, data);

        //throws exception if not a success

        //Read the response text and return it
        string responseBody = await response.Content.ReadAsStringAsync();

        return responseBody;

    catch (Exception e) //if anything goes wrong end the session
        await CloseSession();