Tools and information for 3rd party integrators

GraphQL

SmartCentral has implemented GraphQL to support an extensible integration method for api access to centre data.

Graphql is currently implemented with persistent token based authentication for fast server to server comms.

Contact us for end points and authentication when you are ready.

Schema

Schema definition is here.

Examples

Get a list of enrolments

{
  "query": "{
    service(id: 1) {
      id
      enrolments {
        id
        status
        startDate
      }
    }
  }"
}

Get a single enrolment with details

{
  "query": "{
    service(id: 1) {
      id
      enrolments(id: \"sfdev_22020\") {
        id
        status
        startDate
        child {
          dateOfBirth
          contacts {
            firstName
          }
        }
        parent1 {
          firstName
          email
        }
        parent2 {
          lastName
          phone
        }
      }
    }
  }"
}

Who attended on a particular date? (Actual sessions)

{
  "query": "{
    service(id: 472) {
      id
      sessions(date: \"2020-08-06\") {
        room
        enrolmentId
        fee
        startTime
        endTime
        absent
      }
    }
  }"
}

How many children are present at a certain time?

{
  "query": "{
    service(id: 472) {
      id
      sessions(date: \"2020-08-06T17:00:01Z\") {
        room
        absent
      }
    }
  }"
}

Who will attend in the future, based on bookings.

{
  "query": "{
    service(id: 472) {
      id
      bookedSessions(startDate: \"2021-12-20\", roomId: \"sfsta_762\") {
        enrolmentId
        room
        roomId
        code
        sessionCodeId
        fee
        startTime
        endTime
        absent
      }
    }
  }"
}

Query Application Forms.

The SEPD team has released the change to allow query application forms.

The schema definition:

https://graphqldocs.v.smartcentral.net/object/service#applications

https://graphqldocs.v.smartcentral.net/object/app/

It has one param status. Possible values are:

incomplete, submitted, waitlisted, information_requested, withdrawn, approved

Sample request

{
  "query": "{
    service(id: 979) {
      applications(status: \"submitted\") {
        id
        plannedStartDate
        plannedDays
        childFirstName
        parentLastName
        childDob
      }
    }
  }"
}

List of applications (TEST)

The type of application https://brave-sack.surge.sh/object/app/

{
  "query": "{
    service(id: 1) {
      applications(status: \"submitted\") {
        id
        plannedStartDate
        plannedDays
        childFirstName
        parentLastName
        childDob
      }
    }
  }"
}

List of staff sign in and out (TEST)

https://brave-sack.surge.sh/object/staffatt/

{
  "query": "{
    service(id: 976) {
      staffAtts(date: \"2019-05-15\") {
        in
        out
        date
        firstName
        roomName
        unpaid
      }
    }
  }"
}

Authentication

Fixed Token

A fixed token will be assigned to the integration partner for server to server integration.

OpenID Connect

SmartCentral supports the OpenID Connect specification as an Identity Provider.

Resources for specifications and sample code libraries:

FAQ

Our OpenID entry point for staging is:

To get JWK public keys :

Create your own test account :

Implicit flow

  • 3rd party sends authorisation request

http://test.smartcentral.net/authorizations/new/?client_id=fancy_app&response_type=id_token%20token&scope=openid%20email&nonce=1234&redirect_uri=http://localhost:3001/auth

  • SmartCentral redirects end user to login page if not logged in, after end user’s authorisation, send the following fields (http form fields encoded) to redirect_uri provided by 3rd party.

    • access_token
    • id_tokenhttps://wiki.smartcentral.net/livepreview/images/save_24.png
    • token_type
  • After 3rd party received id_token (JWT format), the id token should be verified using the public key provided by SmartCentral http://test.smartcentral.net/jwks.json

  • To get readble information of the user, 3rd party sends GET request with access token returned by SmartCentral to http://test.smartcentral.net/user_info?access_token=abcd

  • User info returns the following fields:

    • subject (SmartCentral user unique id)
    • name
    • email

Microsft Active Directory Bridging

The following resources contain information on enabling the use of AD to be an OpenID identity provider:

  • https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-protocols-oidc
  • https://docs.microsoft.com/en-us/powerapps/maker/portals/configure/configure-openid-settings