Undo APIs

API call to undo user actions

Examples in this guide reference code from the APS Web Service Client Sample project with a web service proxy configured. If you are just getting started with the APS Web Services APIs, please see our client sample.

API Function

The API is used to undo actions performed by users. There are three variations: UndoActions API, which can be used to undo a specific number of actions; UndoByTransmissionNbr API, which can be used to undo actions up to the action with the given transmission number; and UndoLastUserAction API, which can be used to undo actions up to the last action performed by the given user.

API Parameters

  • Username (string) - the user's username performing the call
  • Password (string) - the user's related password
  • TimeoutDuration (TimeSpan) - the time to wait when trying to connect to Extra Services or getting a data lock. If this parameter is not included in the request, a default value of 30 seconds will be used.
  • scenario (long) - Id of the scenario.
  • NbrOfActionsToUndo (int) / TransmissionNbr (ulong) / InstigatorName (string) - parameters for UndoActions API / UndoByTransmissionNbr API / UndoLastUserAction API specifying the action or actions to undo.

In the UndoActionsAPI, if the NbrOfActionsToUndo is not provided in the API request, the last action will be undone.

    API Request

    This API request inherits from ApsWebScenarioRequest. Check out our KB article on the API Request Base classes to learn more: Basic API Structure

    To use the API, you must create a typed Request using the Request Data Contract. The related web client will use this Request to trigger the process.

    • Data Contract
    [DataContract]
    public class UndoActionsRequest : ApsWebServiceScenarioRequest
    {
    [DataMember(IsRequired = false)]
    public int NbrOfActionsToUndo { get; set; } = 1;
    }

    [DataContract]
    public class UndoByTransmissionNbrRequest : ApsWebServiceScenarioRequest
    {
    [DataMember(IsRequired = true)]
    public ulong TransmissionNbr { get; set; }
    }

    [DataContract]
    public class UndoLastUserActionRequest : ApsWebServiceScenarioRequest
    {
    [DataMember(IsRequired = true)]
    public string InstigatorName { get; set; }
    }
    • Request Examples
    //Create an UndoActions request
    APSWebServiceRef.UndoActionsRequest undoRequest = new UndoActionsRequest() {
    NbrOfActionsToUndo = 2
    };

    //Create an UndoByTransmissionNbr request
    APSWebServiceRef.UndoByTransmissionNbrRequest undoRequest = new UndoByTransmissionNbrRequest() {
    TransmissionNbr = 3
    };

    //Create an UndoLastUserAction request
    APSWebServiceRef.UndoLastUserActionRequest undoRequest = new UndoLastUserActionRequest() {
    InstigatorName = "John"
    };

    //Request Base
    undoRequest.UserName = username;
    undoRequest.Password = pwd;
    undoRequest.TimeoutDuration = TimeSpan.FromMinutes(5);
    undoRequest.ScenarioId = long.MinValue;

        API Response

        All API calls return a Response object to help determine the result of the call. Check out our Basic API Structure KB article for more information.

        Response Example

        //Sending a request
        start = DateTime.Now;
        ApsWebServiceResponseBase resp = client.UndoActions(undoRequest);
        Console.WriteLine($"Response received after '{DateTime.Now.Subtract(start)}'");

        //Display results
        if (!a_response.Exception)
        {
        Trace($"Completed with Zero Errors");
        }
        else
        {
        Trace($"Completed with Errors");
        Trace(a_response.FullExceptionText);
        }