Move API

API Call to move activities

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 Move API is used to move activities.

API Parameters

The Move API uses the following 11 parameters:

  • Username (string) - the user's username performing the call
  • Password (string) - the user's related password. An empty string will be used if this parameter is not included in the request.
  • 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.
  • ScenarioId (long) - Id of the scenario.
  • PtObjects (PtObjecs[]) - An array of objects specify the activities that need to be updated.

PtObject contains 4 string parameters-- JobExternalId, MoExternalId, OperationExternalId and ActivityExternalId. If only JobExternalId is specified, all activities within the job are updated. Suppose JobExternalId and MoExternalId, activities within the specific manufacturing order are updated. If the JobExternalId, MoExternalId, and OperationExternalId are specified, only activities for the specified operation are updated. Finally, if all are specified, only one activity is updated.

  • ResourceExternalId (string) - The id of the target resource.
  • MoveDateTime (DateTime) - The target date for the move.
  • ExpediteSuccessors (boolean) - whether to expedite the successor activities after the move.
  • LockMove (boolean) - whether to lock the activities after the move.
  • AnchorMove (boolean) - whether to anchor the activities after the move.
  • ExactMove (boolean) - whether to move the block exactly to the target date time

API Call

Once the typed Request is created, the API call can be made using the following format:

//Sending a request
ApsWebServiceResponseBase resp = client.Optimize(optimizeRequest);

API Request

This API request inherits from ApsWebServiceActionRequest. 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
public class MoveRequest : ApsWebServiceActionRequest
[DataMember(IsRequired = true)]
public string ResourceExternalId { get; set; }

[DataMember(IsRequired = true)]
public DateTime MoveDateTime { get; set; }

[DataMember(IsRequired = false)]
public bool ExpediteSuccessors { get; set; }

[DataMember(IsRequired = false)]
public bool LockMove { get; set; } = true;

[DataMember(IsRequired = false)]
public bool AnchorMove { get; set; } = true;

[DataMember(IsRequired = false)]
public bool ExactMove { get; set; }

      API Request  Example

      //Create an Optimize request
      APSWebServiceRef.MoveRequest moveRequest = new MoveRequest() {
      ResourceExternalId = "Res 2",
      MoveDateTime = DateTime.Now.AddDays(10),
      ExpediteSuccessors = false,
      LockMove = true,
      AnchorMove = true,
      ExactMove = false

      //Request Base
      moveRequest.UserName = username;
      moveRequest.Password = pwd;
      moveRequest.TimeoutDuration = TimeSpan.FromMinutes(5);

      //Scenario Request
      moveRequest.ScenarioId = long.MinValue;

      //Action Request
      List<PtObjectId> objectIds = new List<PtObjectId>();
      objectIds.Add(new PtObjectId() {JobExternalId = "job1", MoExternalId = "MO010", OperationExternalId = "Op010", ActivityExternalId = "PT00001" });

      moveRequest.PtObjects = objectIds.ToArray();

      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.Move(moveRequest);
      Console.WriteLine($"Response received after '{DateTime.Now.Subtract(start)}'");

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