Inbound API Sites - TechnicheGroup/urgent-rest GitHub Wiki

These notes go alongside the Site swagger definitions to help the user determine the value of fields to submit

Create Site

POST /sites/{tenant}

This method allows you to create a new Site in the Urgent system.

Property Notes
SiteCode Identifier for the site. Unique across the tenant.
ParentCode If the site is a child of another site, for example a room within a building, then this should be the parent site's SiteCode.
Name The name of the site
Address Address object for the site.
Address.Line1
Address.Line2
Address.Line3
Address.Town
Address.County State or Country
Address.Country
Address.PostalCode Postal Code or Zip Code
Location
Location.Latitude
Location.Longitude
Email
Telephone
GeographicAreaMatrixItemCode The Matrix Code of the Geographic Area matrix from the Matrix By Type endpoint using the Geographic Area type. e.g. 01-01-01
SiteChannelMatrixItemCode The Matrix Code of the Site Channel matrix from the Matrix By Type endpoint using the Site Channel type. e.g. 01-01-01
Hazards[] An array of safety hazards at the site. The list of Safety Hazards can be read from the Reference List endpoint using the Health and Safety (V35) group.
Notes[] An array of site notes
Notes[].StartDate Optionally show the note between a set of dates an automatically hide it. If StartDate is populated then EndDate must be populated too. The property is required if you are providing a note and should be set to an empty string if you do not wish to provide a date. Optional after V32 release.
Notes[].EndDate Optionally show the note between a set of dates an automatically hide it. If EndDate is populated then StartDate must be populated too. The property is required if you are providing a note and should be set to an empty string if you do not wish to provide a date. Optional after V32 release.
Notes[].IsWarningNote Boolean to determine of the note is a Warning Note. Warning notes can require users to confirm they have read and understood them prior to performing certain task actions. Property is required to be passed in if adding a note. Optional after V32 release.
Notes[].Note The text of the note
CustomFields[] Custom fields for the Sites. See the Custom FIeld documentation for more information.
CustomFields[].Answer The current answer for the custom field
CustomFields[].DataType The data type for the custom field
CustomFields[].Name The name of the custom field. Unique to the tenant
CustomFields[].Parent The name of the parent field (if any) for the custom field.
CustomFields[].Text The text that was displayed to the user when they answered the custom field.
WorkingHours The name of the Operating Hours object that defines the site's opening hours. See the Working Hours method

Request Examples

Minimum Request

{
  "SiteCode": "TCNEMEA",
  "Name": "Techniche EMEA Limited",
  "Address": {
    "Line1": "Techniche EMEA Limited",
    "Town": "Milton Keynes"
  },
  "GeographicArea": "01-0A-OB",
  "SiteChannel": "01-01",
  "WorkingHours": "24/7"
}

Full Request

{
  "SiteCode": "TCNEMEA",
  "ParentCode": "WTNSTD",
  "Name": "Techniche EMEA Limited",
  "Path": "Witan Studios (WTNSTD) > Techniche EMEA Limited (TCNEMEA)",
  "Address": {
    "Line1": "Techniche EMEA Limited",
    "Line2": "Studio C/2, Witan Studios",
    "Line3": "324 Witan Gate West",
    "Town": "Milton Keynes",
    "County": "Buckinghamshire",
    "Country": "United Kingdom",
    "PostalCode": "MK9 1EJ"
  },
  "Location": {
    "Latitude": -0.767,
    "Longitude": 52.0386
  },
  "Email": "[email protected]",
  "Telephone": "+44 (0) 1908 038 560",
  "GeographicArea": "01-0A-OB",
  "SiteChannel": "01-01",
  "Hazards": [
    "Electrical",
    "Working At Heights",
    "Crocodiles"
  ],
  "Notes": [
    {
      "StartDate": "2021-04-01T00:00:00",
      "EndDate": "2030-04-01T00:00:00",
      "IsWarningNote": false,
      "Note": "Serviced office"
    }
  ],
  "CustomFields": [],
  "WorkingHours": "24/7"
}

Update Site

PUT /sites/{tenant}/{siteidentifier}

The body of the Update Site method uses the same body as the Create Site method, however the siteIdentifier variable should be replaced with the Site Code of the site you are updating.

Delete Site

DELETE /sites/{tenant}/{siteidentifier}

To delete a site use the SiteCode property as the siteidentifier variable when submitting the request.

Read Sites by Tenant

GET /sites/{tenant}/{siteCode?}

This method returns either a list of sites for a given Tenant or a single site if specified by the optional siteCode variable.

Property Notes
SiteCode Identifier for the site. Unique across the tenant
ParentCode If the site is a child of another site, for example a room within a building, then this should will be the parent's SiteCode. The is no limit to the depth of the tree.
Path The full path of the site. Each parent node is in the fomat {name} ({SiteCode} and separated with a >
Name The name of the site
Address Address object for the site.
Address.Line1
Address.Line2
Address.Line3
Address.Town
Address.County State or Country
Address.Country
Address.PostalCode Postal Code or Zip Code
Location
Location.Latitude
Location.Longitude
Email This email address will be used when sending email notifications to the site.
Telephone
GeographicArea The Matrix Text of the Geographic Area matrix from the Matrix By Type endpoint using the Geographic Area type. e.g. Geographic Area > Main Level > Sub Level > Final Level
SiteChannel The Matrix Text of the Site Channel matrix from the Matrix By Type endpoint using the Site Channel type. e.g. Site Channel > Main Level > Sub Level > Final Level
Hazards[] An array of safety hazards at the site. Reading the list of safety hazards will be available in an upcoming release
Notes[] An array of site notes
Notes[].StartDate Optionally show the note between a set of dates an automatically hide it. If StartDate is populated then EndDate must be populated too. The property is required if you are providing a note and should be set to an empty string if you do not wish to provide a date.
Notes[].EndDate Optionally show the note between a set of dates an automatically hide it. If EndDate is populated then StartDate must be populated too. The property is required if you are providing a note and should be set to an empty string if you do not wish to provide a date.
Notes[].IsWarningNote Boolean to determine of the note is a Warning Note. Warning notes can require users to confirm they have read and understood them prior to performing certain task actions. Property is required to be passed in if adding a note.
Notes[].Note The text of the note
CustomFields[] Custom fields for the Sites. See the Custom Field documentation for more information.
WorkingHours The name of the Operating Hours object that defines the site's opening hours. See the Working Hours method
IsActive Is the site currently active or not? (V36.1)

Read Working Hours

GET /sites/workinghours/{tenant}

In order to accurately calculate Service Levels the platform needs to know when the site is open. This method will read all the Working Hours defined for the tenant. Use the Name when Creating or Updating a site. There can be multiple shifts per day. For example a site may be open from 09:00 until 12:00, closed for an hour for lunch and then open from 13:00 until 18:00.

Days are zero based starting on a Sunday.

Example response

"WorkingHours": [
  {
    "Name": "Demo Working Hours",
    "Shifts": [
      {
        "Day": 0,
        "DayName": "Sunday",
        "ShiftStart": "09:00:00",
        "ShiftEnd": "11:59:59"
      },
      {
        "Day": 0,
        "DayName": "Sunday",
        "ShiftStart": "13:00:00",
        "ShiftEnd": "17:59:59"
      },
      {
        "Day": 1,
        "DayName": "Monday",
        "ShiftStart": "00:00:00",
        "ShiftEnd": "23:59:59"
      },
      {
        "Day": 2,
        "DayName": "Tuesday",
        "ShiftStart": "00:00:00",
        "ShiftEnd": "23:59:59"
      },
      {
        "Day": 3,
        "DayName": "Wednesday",
        "ShiftStart": "00:00:00",
        "ShiftEnd": "23:59:59"
      },
      {
        "Day": 4,
        "DayName": "Thursday",
        "ShiftStart": "00:00:00",
        "ShiftEnd": "23:59:59"
      },
      {
        "Day": 5,
        "DayName": "Friday",
        "ShiftStart": "00:00:00",
        "ShiftEnd": "23:59:59"
      },
      {
        "Day": 6,
        "DayName": "Saturday",
        "ShiftStart": "00:00:00",
        "ShiftEnd": "19:59:59"
      }
    ]
  }
]

Read Site Matrix Mappings

GET /sites/{tenant}/{siteCode}/matrixmappings

This method will read all the reactive matrix mappings for a site. It will return two lists - one that shows the matrix codes for all items that are enabled for the site and one that shows the matrix codes for all items that are not enabled for site. The codes can be linked to the ones retrieved from the Matrix By Type method to get the text assigned to the code.

Example response

"Enabled": [
  "01-02-03-04",
  "01-02-03-05",
  "01-02-03-06"
],
"Disabled": [
  "01-02-03-01",
  "01-02-03-02",
  "01-02-03-03"
]