Create, Update or Delete CalendarSet

Prev Next

Create, Update or Delete CalendarSet

/v1/calendarset

Create new Calendar set, update or delete existing Calendar set.

Safran Project ILAP Gateway

This API endpoint is only available in the Safran Project ILAP Gateway product.

Example for calling:

http://server/v1/calendarset
http://server/v1/calendarset?network_id=92
http://server/v1/calendarset?network_id=93&owner=safransa

Allowed Methods:

[POST]
API Controller: project_preview

Description:

Create, update or delete calendar set.

Parameters:

Name Type Description Notes
network_id integer Network ID Mandatory when "SafranWebApiOwnerVerificationDuringApiCalls" is in use, for delete and update actions.
owner string Owner of the calendar set Relates to "SafranWebApiOwnerVerificationDuringApiCalls" in Application Settings


Request Fields:

Syntax of the fields are similar to what is found when using GET /v1/calendarset with additional elements, see CalendarSet.

CalendarSet


Name Type Description Notes
Cal_id integer Calendar Set Id
CalendarSetAction string Action to be performed on the Calendar Set. Valid actions are: "C" - create, "U" - update, "D" - delete
CalendarSetRowId integer Identify a row in this requeset that lines up with the Response Fields
UpdateIfExists boolean
In case of create action and calendar set exist and this is set to true,

the create action will be converted to an update action.

Name Type Description Notes
Cal_id integer Calendar Set Id
CalendarSetAction string Action to be performed on the Calendar Set. Valid actions are: "C" - create, "U" - update, "D" - delete
CalendarSetRowId integer Identify a row in this requeset that lines up with the Response Fields
UpdateIfExists boolean In case of create action and calendar set exist and this is set to true,
the create action will be converted to an update action.
Cal_name string Calendar Set Name
Cal_start datetime Calendar Set start date
Cal_finish datetime Calendar Set finish date
Owner string Owner of the Calendar Set Owner is a user name
Cal_type string Calendar Set type Valid values are: "d" - days, "h" - hours, "m" - minutes
Calendars calendar[] Collection of defined calendar objects
ClearNonWorkingPeriodsDuringUpdate boolean If true - deletes the NonWorkingPeriod records, related to CalendarSet and Calendars. This is only considered if the CalendarSetAction is update.


  • When network_id is provided in the Parameters only one CalendarSet can be sent to the API.
  • When network_id is provided and Cal_id is null or 0, API will attemt getting the cal_id from the network identified with the given network_id.
  • When "SafranWebApiOwnerVerificationDuringApiCalls" as per Application Settings is in use, the CalendarSet being delete or updated (including create with UpdateIfExists) must not exist in other networks.
  • For update and delete actions where Cal_Id is missing, API will idenfiy the CalendarSet using Cal_name and Owner.
  • Delete of CalendarSet which has historical details, or is used in a network, is not permitted and will result in failure.
  • Update or delete of NonWorkingPeriods which has historical details is not permitted and will result in failure.


Response Fields:

Name Type Description Notes
Cal_Id integer Calendar Set Id
Cal_Name string Calendar Set Name
RowId integer Lines up with the CalendarSetRowId in Request Fields
Result string Indicate the success or failure of the action S = success, F = failure


Sample Create CalendarSet Call and Response

Show Call Sample
[
  {
    "Cal_id": null,
    "CalendarSetAction":"C",
    "CalendarSetRowId":1,
    "UpdateIfExists":true,
    "Cal_name": "Work Calendar",
    "Cal_start": "2020-02-04T00:00:00",
    "Cal_finish": "2020-02-04T00:00:00",
    "Owner": "SAFRANSA",
    "Cal_type": "d",
    "Calendars": [
      {
        "Hours": 7.5,
        "Description": "Standard",
        "Wpn": 0,
        "Units_pr_week": 5.0,
        "NonWorkingPeriods": []
      },
      {
        "Hours": 24.0,
        "Description": "Offshore 24/7",
        "Wpn": 1,
        "Units_pr_week": 7.0,
        "NonWorkingPeriods": []
      },
      {
        "Hours": 12.0,
        "Description": "Offshore 12/7",
        "Wpn": 2,
        "Units_pr_week": 7.0,
        "NonWorkingPeriods": []
      },
      {
        "Hours": 8.0,
        "Description": "Kontor",
        "Wpn": 3,
        "Units_pr_week": 5.0,
        "NonWorkingPeriods": [
          {
            "Day_of_week": 7,
            "Rest_from_hrs": 0,
            "Rest_until_hrs": 0,
            "Rest_from_min": 0,
            "Rest_until_min": 0
          },
          {
            "Day_of_week": 6,
            "Rest_from_hrs": 0,
            "Rest_until_hrs": 0,
            "Rest_from_min": 0,
            "Rest_until_min": 0
          }
        ]
      }
    ]
  }
]

Show Response Sample

json result

[
  {
    "Cal_Id": 2,
    "Cal_Name": "Work Calendar",
    "RowId": 1,
    "Result": "S"
  }
]