- Print
- DarkLight
- PDF
Create, Update or Delete activity
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:
Name | Type | Description | Notes |
---|---|---|---|
create_activities | create_activity[] | collection of activities to be created/updated/deleted | Head element not specified – see example |
create_activity
Name | Type | Description |
---|---|---|
ActivityRowID | integer | identifying a row in this request that lines up with the response |
ActivityAction | string | specification of action: “C”reate, “U”pdate, “D”elete |
UpdateIfExists | boolean | UpdateIfExists flag for Create |
Activity | Activity[] | Activity object (same structure as GET object, but without Resources) |
create_resources | create_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
Name | Type | Description |
---|---|---|
ResourceRowID | integer | Identifying a row in this request that lines up with the response |
ResourceAction | string | specification of action: “C”reate, “U”pdate, “D”elete |
Resource | Resource | Resource 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
Name | Type | Description | Notes |
---|---|---|---|
RowID | integer | corresponds to the ActivityRowID in the request | |
Result | byte | S(uccess) or F(ail) indicating if the requested action was successfully executed | |
Message | string | Empty if success; error message if the requested action failed. | |
MessageId | integer | MessageId: Identifies error message | |
ActivityID | integer | Safran Activity ID | |
ActivityName | string | Safran activity name | |
create_resource_responses | create_resource_response[] | collection of responses for each resource row per activity request:1. ResourceRowID2. ResourceResult3. ResourceID | |
create_activity_texts_responses | create_activity_texts_responses[] | collection of responses for each text per activity request |
create_resource_responses:
Resource response Fields: collection of create_resource_response objects
Name | Type | Description |
---|---|---|
RowID | integer | Identifying a row in this request that lines up with create_resource request |
Result | string | S(uccess) or (F)ailure indicating if the request action was successfully executed |
Message | string | Empty if success; error message if the request action failed |
MessageID | integer | MessageId: Identifies error messsage |
ResourceId | integer | Resource seq |
create_activity_texts_responses:
Activity text response fields: collection of create_activity_texts_response object
Name | Type | Description |
---|---|---|
RowId | integer | Identifying a row in this request that lines up with activity row |
Result | string | S(uccess) or F(ailure), indicating if the request action was successfully executed |
Message | string | Message related to action performed |
NetworkId | integer | Network the activity text belongs too. |
seq | integer | Relates to the activity hosting the text |
Field_nr | integer | Identification 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"
}
]