POST api/Activity/UpdateActivity

Update an activity

Exceptions

ExceptionCondition
HttpResponseException

Will throw HTTP status code 401 if we cannot login

ArgumentNullHttpResponseException

If an required attribute is null

ArgumentOutOfRangeException

If an attribute is out of range, for example if you set country the an invalid country

KeyNotFoundHttpResponseException

If a key for cannot be found, for example if you specify a attribute name that does not exist

ReadOnlyHttpResponseException

If you try to update a read only attribute

ArgumentMissingHttpResponseException

If you are missing a required attribute, for example not setting all required fields when creating a new activity.

Remarks

If CombinedActivityId is not specified we will treat the update as new activity. In this case we will look for a field update with AttributeName named CombinedContractLineId. If this attribute cannot be found we will throw a ArgumentMissingHttpResponseException exception. If you want to create a new activity we recommend that you call ActivityController.CreateActivity(CreateActivityArgumentModel) first to get an update model you can modify and then send back to this method. You will find a sample of this in ActivityController.CreateActivity(CreateActivityArgumentModel)

Examples

Update solution description


 var updates = new Array();
 //Add update
 updates.push({
     AttributeAction : 1, //update
     AttributeType : 0,   //field update
     AttributeData : {
         FieldName : "SolutionDescription",
         FieldValue : "Changed hard drive, tested OK"
         }
  });
  //Setup the ActivityArgumentModel
  var arg = {
     TicketId :'7ECEB7B7-B533-492D-8321-E92D198551AF',
     CombinedActivityId : 'sesam10:1234567',
     TransactionKey : "383763838393",
     ActivityUpdates : updates
  };
  //Make ajax call
  $.ajax({
    url: 'https://api.infocare.com/api/Activity/UpdateActivity',
    type: "POST",
    data: JSON.stringify(arg),
    contentType: "application/json;charset=utf-8"
 })
 

Request Information

URI Parameters

None.

Body Parameters

Set which updates you want to perform, see ActivityArgumentModel for more details

ActivityArgumentModel
NameDescriptionTypeAdditional information
CombinedContractLineId

Gets or sets the combined contract line id. If this property is specified and CombinedActivityId is not specified a new activity will be created based on this contract line and the updates specified in the ActivityUpdates list will be applied to the newly created activity.

string

None.

TransactionKey

Gets or sets the transaction key you got when getting the activity

string

None.

ActivityUpdates

Gets or sets a list of update actions.

Collection of AttributeUpdateModel

None.

IsPublicCommentsAllowed

Gets or sets whether you are allowed to create public comments.

boolean

None.

CombinedActivityId

Get or set combined activity id

string

None.

FormName

Gets or sets the optional FormName. The FormName is used to limit the number of fields returned from GetActivity.

string

None.

TicketId

Gets or sets the ticket id

string

None.

Culture

Gets or sets culture, if not specified we will use culture set on user.

string

None.

Request Formats

application/json, text/json

Sample:
{
  "CombinedContractLineId": "sample string 1",
  "TransactionKey": "sample string 2",
  "ActivityUpdates": [
    {
      "AttributeName": "sample string 1",
      "AttributeAction": 0,
      "AttributeType": 0,
      "AttributeTransaction": "sample string 2",
      "AttributeData": {}
    },
    {
      "AttributeName": "sample string 1",
      "AttributeAction": 0,
      "AttributeType": 0,
      "AttributeTransaction": "sample string 2",
      "AttributeData": {}
    }
  ],
  "IsPublicCommentsAllowed": true,
  "CombinedActivityId": "sample string 4",
  "FormName": "sample string 5",
  "TicketId": "sample string 6",
  "Culture": "sample string 7"
}

application/xml, text/xml

Sample:
<ActivityArgumentModel xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Rostov.Models">
  <Culture>sample string 7</Culture>
  <TicketId>sample string 6</TicketId>
  <CombinedActivityId>sample string 4</CombinedActivityId>
  <FormName>sample string 5</FormName>
  <ActivityUpdates>
    <AttributeUpdateModel>
      <AttributeAction>Add</AttributeAction>
      <AttributeData />
      <AttributeName>sample string 1</AttributeName>
      <AttributeTransaction>sample string 2</AttributeTransaction>
      <AttributeType>Field</AttributeType>
    </AttributeUpdateModel>
    <AttributeUpdateModel>
      <AttributeAction>Add</AttributeAction>
      <AttributeData />
      <AttributeName>sample string 1</AttributeName>
      <AttributeTransaction>sample string 2</AttributeTransaction>
      <AttributeType>Field</AttributeType>
    </AttributeUpdateModel>
  </ActivityUpdates>
  <CombinedContractLineId>sample string 1</CombinedContractLineId>
  <IsPublicCommentsAllowed>true</IsPublicCommentsAllowed>
  <TransactionKey>sample string 2</TransactionKey>
</ActivityArgumentModel>

application/x-www-form-urlencoded

Sample:

Failed to generate the sample for media type 'application/x-www-form-urlencoded'. Cannot use formatter 'JQueryMvcFormUrlEncodedFormatter' to write type 'ActivityArgumentModel'.

Response Information

Resource Description

Returns additional updates that you updates may have caused. For example setting activity on pause will update the SesamState field

ActivityReturnModel
NameDescriptionTypeAdditional information
CombinedActivityId

Gets or sets the combined activity id

string

None.

TransactionKey

Gets or sets the transaction key you got when getting the activity

string

None.

ActivityUpdates

Gets or sets a list of update actions.

Collection of AttributeUpdateModel

None.

AllowableActions

Sets or gets allowable actions. Note that enumeration is a bit/flag enumeration.

AllowableActivityActions

None.

CombinedContractLineId

Gets or sets the combined contract line

string

None.

CombinedPerformanceId

Gets or sets the performance id. If performance monitoring is not turned on this property will not be present or set to null

string

Json null value handling: Ignore

Response Formats

application/json, text/json

Sample:
{
  "CombinedActivityId": "sample string 1",
  "TransactionKey": "sample string 2",
  "ActivityUpdates": [
    {
      "AttributeName": "sample string 1",
      "AttributeAction": 0,
      "AttributeType": 0,
      "AttributeTransaction": "sample string 2",
      "AttributeData": {}
    },
    {
      "AttributeName": "sample string 1",
      "AttributeAction": 0,
      "AttributeType": 0,
      "AttributeTransaction": "sample string 2",
      "AttributeData": {}
    }
  ],
  "AllowableActions": 1,
  "CombinedContractLineId": "sample string 3",
  "CombinedPerformanceId": "sample string 4"
}

application/xml, text/xml

Sample:
<ActivityController.ActivityReturnModel xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Rostov.Controllers">
  <CombinedPerformanceId xmlns="http://schemas.datacontract.org/2004/07/Rostov.Models">sample string 4</CombinedPerformanceId>
  <ActivityUpdates xmlns:d2p1="http://schemas.datacontract.org/2004/07/Rostov.Models">
    <d2p1:AttributeUpdateModel>
      <d2p1:AttributeAction>Add</d2p1:AttributeAction>
      <d2p1:AttributeData />
      <d2p1:AttributeName>sample string 1</d2p1:AttributeName>
      <d2p1:AttributeTransaction>sample string 2</d2p1:AttributeTransaction>
      <d2p1:AttributeType>Field</d2p1:AttributeType>
    </d2p1:AttributeUpdateModel>
    <d2p1:AttributeUpdateModel>
      <d2p1:AttributeAction>Add</d2p1:AttributeAction>
      <d2p1:AttributeData />
      <d2p1:AttributeName>sample string 1</d2p1:AttributeName>
      <d2p1:AttributeTransaction>sample string 2</d2p1:AttributeTransaction>
      <d2p1:AttributeType>Field</d2p1:AttributeType>
    </d2p1:AttributeUpdateModel>
  </ActivityUpdates>
  <AllowableActions>AddComment</AllowableActions>
  <CombinedActivityId>sample string 1</CombinedActivityId>
  <CombinedContractLineId>sample string 3</CombinedContractLineId>
  <TransactionKey>sample string 2</TransactionKey>
</ActivityController.ActivityReturnModel>