Create, Update or Delete activity
  • 10 Sep 2024
  • 3 Minutes to read
  • Contributors
  • Dark
    Light
  • PDF

Create, Update or Delete activity

  • Dark
    Light
  • PDF

Article summary

Create/update/delete Activities

/v1/activities

Create, update or delete Activities
Maintain Activities

Example for calling:

http://server/v1/activities

Request Body = {….} see request fields below

Allowed Methods:

[POST]

API Controller: activity

Description:

Create/update/delete activities is done in one single Web Service call with an indicator to specify Create or Update or Delete.

Request Fields:

NameTypeDescriptionNotes
create_activitiescreate_activity[]collection of activities to be created/updated/deletedHead element not specified – see example

create_activity

NameTypeDescription
ActivityRowIDintegeridentifying a row in this request that lines up with the response
ActivityActionstringspecification of action: “C”reate, “U”pdate, “D”elete
UpdateIfExistsbooleanUpdateIfExists flag for Create
ActivityActivity[]Activity object (same structure as GET object, but without Resources)
create_resourcescreate_resource[]Collection of resource assignments for this activity to be created/updated/deleted
  • When specifying "duration_format" for the Activity[], the value must be permitted for the calendar set used in the network, else failure will generated.
  • It is not permitted to update the "item_guid" field in the Activity[].
  • When creating an activity it is permitted to provide a valid GUID in the "item_guid" field.
  • When creating an activity linked to a project which is part of a sub project, the "subnetwork_id" has to be provided.
  • When deleting, item guid takes priority over network id, activit id and activity name.
  • “Update if exists”, when a create post call is made to the system, the system will check if the activity is already present in its database. If it does not exist it will be created, if it does exist and the flag “Update if exists” is FALSE – the system will return an error. However, if the “Update if exists” is TRUE and the activity exists, the system will perform an update on the existing record.

create_resource

NameTypeDescription
ResourceRowIDintegerIdentifying a row in this request that lines up with the response
ResourceActionstringspecification of action: “C”reate, “U”pdate, “D”elete
ResourceResourceResource object (same structure as GET resource object)
  • When creating a new resource and the resource network_id is missing or null, the network_id of the activitiy will be used.
  • When creating or updateing resource with vo_seq missing or null, API will use the changeorder_number to identify the vo_seq.
  • When vo_seq is present, it will be used.

Response Fields:

create_activity_response[] – collection of create_activity_response objects

NameTypeDescriptionNotes
RowIDintegercorresponds to the ActivityRowID in the request
ResultbyteS(uccess) or F(ail) indicating if the requested action was successfully executed
MessagestringEmpty if success; error message if the requested action failed.
MessageIdintegerMessageId: Identifies error message
ActivityIDintegerSafran Activity ID
ActivityNamestringSafran activity name
create_resource_responsescreate_resource_response[]collection of responses for each resource row per activity request:1. ResourceRowID2. ResourceResult3. ResourceID
create_activity_texts_responsescreate_activity_texts_responses[]collection of responses for each text per activity request


create_resource_responses:

Resource response Fields: collection of create_resource_response objects

NameTypeDescription
RowIDintegerIdentifying a row in this request that lines up with create_resource request
ResultstringS(uccess) or (F)ailure indicating if the request action was successfully executed
MessagestringEmpty if success; error message if the request action failed
MessageIDintegerMessageId: Identifies error messsage
ResourceIdintegerResource seq


create_activity_texts_responses:

Activity text response fields: collection of create_activity_texts_response object

NameTypeDescription
RowIdintegerIdentifying a row in this request that lines up with activity row
ResultstringS(uccess) or F(ailure), indicating if the request action was successfully executed
MessagestringMessage related to action performed
NetworkIdintegerNetwork the activity text belongs too.
seqintegerRelates to the activity hosting the text
Field_nrintegerIdentification of the activity text


Sample Create Activities Call and Response

Show Call Sample

json result

[
   {
      "ActivityRowID":1,
      "ActivityAction":"C",
      "UpdateIfExists":true,
      "id":null,
      "name":"CSNew001",
      "duration":1,
      "network_id":1,
      "create_resources":[
         {
            "ResourceRowID":1,
            "ResourceAction":"C",
            "id":null,
            "resource_def_id":1,
            "qty":2
         },
         {
            "ResourceRowID":2,
            "ResourceAction":"U",
            "id":941,
            "resource_def_id":1,
            "qty":5
         },
         {
            "ResourceRowID":3,
            "ResourceAction":"C",
            "current_progress":0.0,
            "duration":20,
            "resource_def_id":1,
            "calendar":2,
            "id":null,
            "name":"qty",
            "qty":100.0,
            "qty1":99.0,
            "type":1,
            "changeorder_number":"XYZ789",
            "changeorder_type":"R"
         }
      ]
   },
   {
      "ActivityRowID":2,
      "ActivityAction":"C",
      "UpdateIfExists":true,
      "id":null,
      "name":"CSNew002",
      "duration":1,
      "network_id":1,
      "create_resources":[
         {
            "ResourceRowID":1,
            "ResourceAction":"C",
            "id":null,
            "resource_def_id":1,
            "qty":2
         },
         {
            "ResourceRowID":2,
            "ResourceAction":"U",
            "id":941,
            "resource_def_id":1,
            "qty":5
         }
      ]
   }
]

Show Response Sample

json result

[
  {
    "ActivityId": 1143,
    "ActivityName": "CSNew001",
    "Create_Resource_Responses": [
      {
        "ResourceId": 943,
        "RowId": 1,
        "Result": "S"
      },
      {
        "ResourceId": 941,
        "RowId": 2,
        "Result": "S"
      }
    ],
    "RowId": 1,
    "Result": "S"
  },
  {
    "ActivityId": 1144,
    "ActivityName": "CSNew002",
    "Create_Resource_Responses": [
      {
        "ResourceId": 944,
        "RowId": 1,
        "Result": "S"
      },
      {
        "ResourceId": 941,
        "RowId": 2,
        "Result": "S"
      }
    ],
    "RowId": 2,
    "Result": "S"
  }
]


Was this article helpful?

What's Next
ESC

Eddy AI, facilitating knowledge discovery through conversational intelligence