Time Blocks (Holidays & PTO) - GetBric/API GitHub Wiki

Time Blocks can be either company-wide holidays or individual time off for People.

Time Blocks Index

  • Route: /time_blocks
  • Method: GET
  • Expected Response:
{
  "time_blocks": [
    {
      "id": 113629430,
      "link": "https://api.getbric.com/v1/time_blocks/113629430",
      "person": {
        "id": 491142988,
        "link": "https://api.getbric.com/v1/people/491142988",
        "first_name": "Heather",
        "last_name": "Evans",
        "email": "[email protected]"
      },
      "data": {
        "event_name": "PTO",
        "start_date": "3/4/2016",
        "end_date": "3/5/2016",
        "day_config": [
          {
            "date": "2016/03/04",
            "all_day": false,
            "hours": "4"
          },
          {
            "date": "2016/03/05",
            "all_day": true,
            "hours": 0
          }
        ]
      },
      "start_date": "2016-03-04",
      "end_date": "2014-03-05",
      "created_at": "2015-11-19T01:26:01.000-05:00",
      "updated_at": "2016-01-27T12:39:15.420-05:00"
    },
    {
      "id": 980190985,
      "link": "https://api.getbric.com/v1/time_blocks/980190985",
      "person": null,
      "data": {
        "event_name": "Company Trip to Tahiti",
        "start_date": "03/22/2016",
        "end_date": "03/23/2016",
        "day_config": [
          {
            "date": "2016/03/22",
            "all_day": true,
            "hours": null
          },
          {
            "date": "2016/03/23",
            "all_day": true,
            "hours": null
          }
        ]
      },
      "start_date": "2016-03-22",
      "end_date": "2016-03-23",
      "created_at": "2016-03-24T12:17:36.275-04:00",
      "updated_at": "2016-03-24T12:17:36.275-04:00"
    }
  ]
}

Time Block Create

  • Route: /time_blocks
  • Method: POST
  • Required Fields:
    • start_date (format: 2016/04/23)
    • event_name
  • Allowed Fields:
    • end_date (defaults to same day as start_date, format: 2016/04/23)
    • person_id (if blank, you will create a company wide holiday.)
    • hours (if blank, you will create a time block for the entire day. Otherwise, enter a comma separated list for each day i.e. if you are taking two days of vacation with 4 hours the first day and 8 hours the next day, enter 4,8)
  • Expected Response:
{
  "time_blocks": {
    "id": 980191004,
    "link": "https://api.getbric.com/v1/time_blocks/980191004",
    "person": {
      "id": 491142988,
      "link": "https://api.getbric.com/v1/people/491142988",
      "first_name": "Heather",
      "last_name": "Evans",
      "email": "[email protected]"
    },
    "data": {
      "event_name": "PTO",
      "start_date": "04/22/2016",
      "end_date": "04/23/2016",
      "day_config": [
        {
          "date": "2016/04/22",
          "all_day": false,
          "hours": 4
        },
        {
          "date": "2016/04/23",
          "all_day": false,
          "hours": 8
        }
      ]
    },
    "start_date": "2016-04-22",
    "end_date": "2016-04-23",
    "created_at": "2016-04-15T17:00:49.434-04:00",
    "updated_at": "2016-04-15T17:00:49.434-04:00"
  }
}

Time Block Show

  • Route: /time_blocks/id
  • Method: GET
  • Expected Response:
{
  "time_blocks": {
    "id": 980191004,
    "link": "https://api.getbric.com/v1/time_blocks/980191004",
    "person": {
      "id": 491142988,
      "link": "https://api.getbric.com/v1/people/491142988",
      "first_name": "Heather",
      "last_name": "Evans",
      "email": "[email protected]"
    },
    "data": {
      "event_name": "PTO",
      "start_date": "04/22/2016",
      "end_date": "04/23/2016",
      "day_config": [
        {
          "date": "2016/04/22",
          "all_day": false,
          "hours": 4
        },
        {
          "date": "2016/04/23",
          "all_day": false,
          "hours": 8
        }
      ]
    },
    "start_date": "2016-04-22",
    "end_date": "2016-04-23",
    "created_at": "2016-04-15T17:00:49.434-04:00",
    "updated_at": "2016-04-15T17:00:49.434-04:00"
  }
}

Time Block Update

  • Route: /time_blocks/id
  • Method: PATCH
  • Allowed Fields:
    • start_date (format: 2016/04/23)
    • event_name
    • end_date (defaults to same day as start_date, format: 2016/04/23)
    • person_id (if blank, you will create a company wide holiday.)
    • hours (if blank, you will create a time block for the entire day. Otherwise, enter a comma separated list for each day i.e. if you are taking two days of vacation with 4 hours the first day and 8 hours the next day, enter 4,8)
  • Expected Response:
{
  "time_blocks": {
    "id": 980191006,
    "link": "https://api.getbric.com/v1/time_blocks/980191006",
    "person": null,
    "data": {
      "event_name": "Golf Outings",
      "start_date": "04/22/2016",
      "end_date": "04/23/2016",
      "day_config": [
        {
          "date": "2016/04/22",
          "all_day": false,
          "hours": 4
        },
        {
          "date": "2016/04/23",
          "all_day": false,
          "hours": 4
        }
      ]
    },
    "start_date": "2016-04-22",
    "end_date": "2016-04-23",
    "created_at": "2016-04-15T17:04:46.548-04:00",
    "updated_at": "2016-04-15T17:04:46.548-04:00"
  }
}

Time Block Destroy

  • Route: /time_blocks/id
  • Method: DELETE
  • Expected Response:
{
  "time_blocks": {
    "id": 980191006,
    "link": "https://api.getbric.com/v1/time_blocks/980191006",
    "person": null,
    "data": {
      "event_name": "PTO",
      "start_date": "04/22/2016",
      "end_date": "04/23/2016",
      "day_config": [
        {
          "date": "2016/04/22",
          "all_day": false,
          "hours": 4
        },
        {
          "date": "2016/04/23",
          "all_day": false,
          "hours": 4
        }
      ]
    },
    "start_date": "2016-04-22",
    "end_date": "2016-04-23",
    "created_at": "2016-04-15T17:04:46.548-04:00",
    "updated_at": "2016-04-15T17:04:46.548-04:00"
  }
}