Create, Update or Delete CalendarSet
  • 17 Jul 2024
  • 3 Minutes to read
  • Contributors
  • Dark
    Light
  • PDF

Create, Update or Delete CalendarSet

  • Dark
    Light
  • PDF

Article summary

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:

NameTypeDescriptionNotes
network_idintegerNetwork IDMandatory when "SafranWebApiOwnerVerificationDuringApiCalls" is in use, for delete and update actions.
ownerstringOwner of the calendar setRelates 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.

NameTypeDescriptionNotes
Cal_idintegerCalendar Set Id
CalendarSetActionstringAction to be performed on the Calendar Set. Valid actions are: "C" - create, "U" - update, "D" - delete
CalendarSetRowIdintegerIdentify a row in this requeset that lines up with the Response Fields
UpdateIfExistsbooleanIn 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_namestringCalendar Set Name
Cal_startdatetimeCalendar Set start date
Cal_finishdatetimeCalendar Set finish date
OwnerstringOwner of the Calendar SetOwner is a user name
Cal_typestringCalendar Set typeValid values are: "d" - days, "h" - hours, "m" - minutes
Calendarscalendar[]Collection of defined calendar objects
ClearNonWorkingPeriodsDuringUpdatebooleanIf 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:

NameTypeDescriptionNotes
Cal_IdintegerCalendar Set Id
Cal_NamestringCalendar Set Name
RowIdintegerLines up with the CalendarSetRowId in Request Fields
ResultstringIndicate the success or failure of the actionS = 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"
  }
]


Was this article helpful?

What's Next