CalendarSet
  • 17 Jul 2024
  • 2 Minutes to read
  • Contributors
  • Dark
    Light
  • PDF

CalendarSet

  • Dark
    Light
  • PDF

Article summary

CalendarSet

/v1/calendarset

Example for calling:

http://server/v1/CalendarSet?id=2094 - retrieves all Calendars from a calendar set with CalendarSet id 2094

http://server/v1/CalendarSet?network_id=94 - retrieves Calendars from a calendar set related to a network with network ID 94

http://server/v1/CalendarSet?network_id=94&meta_field_select=CN - retrieves Calendars from a calendar set related to a network with network id 94, including calendars and non-working period details

http://server/v1/CalendarSet?network_id=94&meta_field_select=0 - retrieves Calendars from a calendar set related to a network with network id 94, excluding calendars and non-working period details

http://server/v1/CalendarSet?meta_field_select=0&owner=safran - retrieves all Calendars from a calendar set where the owner is safran, excluding calendars and non-working period details

information16x16 The calendar set id is found in the Project Response Fields as "cal_id".

Allowed Methods:

[GET]
API Controller: CalendarSet

Description:

Lists Calendar set for the supplied calendar set id.


Parameters:

NameTypeDescriptionNotes
idintegerCalendar Set ID
network_idintegerNetwork IDMandatory when "SafranWebApiOwnerVerificationDuringApiCalls" is in use
ownerstringOwner of the calendar setRelates to "SafranWebApiOwnerVerificationDuringApiCalls" in Application Settings
meta_field_selectstringList of fields to include in the response, see Response FieldsOption to decide whether the Calendars and NoneWorkingPeriods elements are to be included in the response fields. If empty or missing, all fields will be included.
0 = Do not include Calendars and NoneWorkingPeriods elements
C = Include Calendars but not NoneWorkingPeriods elements
N = Include NoneWorkingPeriods, this will also force inclusion of Calendars elements.
  • Combining id with network_id is not supported.
  • When "SafranWebApiOwnerVerificationDuringApiCalls" is used, the CalendarSet retrieved can only be linked to projects owned by the same owner as the Calendar Set. Should the CalendarSet be linked to other projects owned by others, the API will return failure.
  • When meta_field_select=0 and the "SafranWebApiOwnerVerificationDuringApiCalls" are in use, the owner is mandatory, but either of the IDs is not.


Response Fields


CalendarSet

NameTypeDescription
cal_idintegerCalendar set ID
cal_namestringCalendar set name
cal_startdatetimeCalenddar set start date
cal_finishdatetimeCalendar set finish date
ownerstringOwner (Username)
cal_typestringd=days, h=hours, m=minutes
Calendarscalendar[]Collection of defined calendar objects


Calendar

NameTypeDescription
HoursdoubleWork hours per day
DescriptionstringDescription
Cal_idintegerCalenddar set ID
WpnintegerCalendar number
Units_pr_weekdoublePlanned work days per week (used for conversion to days when duration is given by weeks)
NonWorkingPeriodsNonWorkingPeriod[]Collection of defined NonWorkingPeriod objects

NonWorkingPeriod

NameTypeDescription
Cal_idintCalenddar set ID
WpnintCalendar number
Rest_fromdatetimeRest from date/time
Rest_untildatetimeRest until date/time
Day_of_weekshortRest day of Week (Available values are 1,2,3,4,5,6,7,8,9)
Rest_from_hrsshortRest from hours
Rest_until_hrsshortRest until hours
SeqintUnique sequence number
Rest_from_minshortRest from minute
Rest_until_minshortRest until minute


Sample Calendar set shown in Safran Project:

API Methods Calendar Sets Window


Calendar Db model overview:

API Methods Calendar DB Model


Calendar API class structure overview:

API Methods Class Structure


Sample JSON
[
  {
    "Cal_id": 2094,
    "Cal_name": "Sample Calendar Set",
    "Cal_start": "2015-01-01T00:00:00",
    "Cal_finish": "2036-12-31T00:00:00",
    "Owner": "SA",
    "Cal_type": "d",
    "Calendars": [
      {
        "Hours": 7.5,
        "Description": "Calendar 0",
        "Cal_id": 2094,
        "Wpn": 0,
        "Units_pr_week": 7,
        "NonWorkingPeriods": [
          {
            "Cal_id": 2094,
            "Wpn": 0,
            "Day_of_week": 6,
            "Rest_from_hrs": 0,
            "Rest_until_hrs": 0,
            "Seq": 712015,
            "Rest_from_min": 0,
            "Rest_until_min": 0 
          },
          {
            "Cal_id": 2094,
            "Wpn": 0,
            "Day_of_week": 7,
            "Rest_from_hrs": 0,
            "Rest_until_hrs": 0,
            "Seq": 712016,
            "Rest_from_min": 0,
            "Rest_until_min": 0 
          }
        ]
      }
    ]
  }
]


Was this article helpful?