Skip to content
krmarien edited this page Aug 4, 2014 · 3 revisions

Litus API

Auth

  • Basic auth info
  • Global URL: /{language}/api/auth/{action}/
  • Actions:
    • getPerson: get person information

GetPerson POST request

{
    'access_token': {access token}
}

or

{
    'session': {session id}
}

or

{
    'username': {the username}
}

GetPerson result

{
    'username': {the username},
    'full_name': {the full name},
    'email': {the email}
}

Calendar

  • Get json of all active events
  • Global URL: /{language}/api/calendar/{action}/
  • Actions:
    • activeEvents: GET request, get an array of all active events
    • poster: POST request, get an image with the unique poster identifier

Event json structure

{
    'id': {id},
    'title': {title},
    'content': {content in MarkDown},
    'startDate' => {ISO 8601 date},
    'endDate' => {ISO 8601 date or null},
    'poster' => {unique poster identifier},
    'location' => {location}
}

Poster POST request

{
    'poster': {unique poster identifier}
}

Cudi

  • Communication with Cudi
  • Global URL: /{language}/api/cudi/{action}/
  • Actions:
    • articles: POST request, get an array of all articles
    • book: POST request, book an article, returns list of all bookings
    • bookings: POST request, get an array of all bookings
    • cancelBooking: POST request, cancel a booking
    • currentSession: (POST request), get information about current session, if authenticated possibility to sign in
    • openingHours: GET request, get an array of all opening hours
    • signIn: POST request, sign in for current session
    • signInStatus: POST request, get status of user in cudi queue

Articles POST request

{
    'access_token': {access token}
}

Articles array

{
    'subjects': [
        {
            'id': {unique id of subject},
            'title': {title of subject}
        }
    ],
    'articles': [
        {
            'id': {unique id of article},
            'title': {article title},
            'subjects': [
                {
                    'id': {subject id},
                    'mandatory': {flag whether this article is mandatory or not}
                }
            ],
            'price': {article price},
            'sold': {flag whether this article is already bought},
            'bookable': {flag whether this article is bookable},
            'unbookable': {flag whether this article is unbookable}
        }
    ]
}

Book POST request

{
    'access_token': {access token},
    'id': {article id}
}

Bookings POST request

{
    'access_token': {access token}
}

Bookings array

{
    'bookings': [
        {
            'id': {unique identifier of booking},
            'assigned': {flag whether this booking is already assigned},
            'expirationDate': {ISO 8601 date},
            'number': {number of articles in this booking},
            'article': {article id}
        }
    ]
    'articles': [ // articles not in default list
        {
            'id': {unique id of article},
            'title': {article title},
            'subjects': [
                {
                    'id': {subject id},
                    'mandatory': {flag whether this article is mandatory or not}
                }
            ],
            'price': {article price},
            'sold': {flag whether this article is already bought},
            'bookable': {flag whether this article is bookable},
            'unbookable': {flag whether this article is unbookable}
        }
    ]
}

CancelBooking POST request

{
    'access_token': {access token},
    'id': {booking id}
}

CurrentSession POST request

If this is not a post request, no extra information about sign in is given

{
    'access_token': {access token},
}

CurrentSession result

{
    'status': {status of sale session open/closed},
    'numberInQueue': {number of people in the queue},
    'canSignIn': {Flag whether person can sign in}, 
    'hasBookings': {Flag whether person has bookings, no bookings: unable to sign in}
}

OpeningHours result

{
    'startDate': {ISO 8601 date},
    'endDate': {ISO 8601 date},
    'comment': {string with extra info}
}

SignIn POST request

{
    'access_token': {access token},
}

SignIn result

{
    'status': {status of request: succes otherwise error thrown},
    'number': {your number in the queue}
}

SignInStatus POST request

{
    'access_token': {access token},
}

SignInStatus result

{
    'status': {status of person in queue},
    'number': {your number in the queue},
    'paydesk': {the pay desk number}
}

Config

  • Get some config values,
  • Global URL: /{language}/api/config/{action}/
  • Actions:
    • entries: GET request, get all config values

Config values

  • cudi.maximum_signin_distance: max distance in meters from cudi to allow sign in
  • cudi.location: the location of cudi
  • shift.signout_treshold: the threshold in seconds before a shift sign out is not allowed anymore

Entries result

{
    {key}: {value}
}

News

  • Get json of all news events
  • Global URL: /{language}/api/news/{action}/
  • Actions:
    • all: GET request, get an array of all news entries

News result

{
    'id': {the unique identifier of the news entry},
    'creationTime': {ISO 8601 date},
    'endDate': {ISO 8601 date},
    'message': {message in MarkDown}
    'summary': {the summary in HTML}
    'title': {the title}
}

OAuth

  • OAuth
  • Global URL: /{language}/api/oauth/{action}[/identification/{identification}[/hash/{hash}]]/
  • Actions:
    • authorize: GET request, show login screen
    • shibboleth: redirect to this page after shibboleth authentication
    • token: POST request, get OAuth tokens

Authorize GET request

{
    'response_type': 'code',
    'client_id': {unique client identifier},
    'redirect_uri': {the redirect URI}
}

Token POST request

{
    'grant_type': authorization_code/refresh_token,
    'code': {the code of the user},
    'client_id': {unique client identifier},
}

Token result

{
    'access_token': {token},
    'expires_in': {expires in seconds},
    'token_type': Bearer,
    'refresh_token': {refresh token}
}

Shift

  • Get all info of shifts
  • Global URL: /{language}/api/shift/{action}/
  • Actions:
    • active: POST request, Get an array of all shifts
    • responsible: POST request, Sign in as repsonsible
    • volunteer: POST request, Sign in as volunteer
    • signOut: POST request, Sign out

Active POST request

{
    'access_token': {access token},
}

Active result

[
    {
        'id': {the id},
        'canHaveAsResponsible': {boolean},
        'canHaveAsVolunteer': {boolean},
        'description': {the description},
        'currentNbResponsibles': {integer},
        'currentNbVolunteers': {integer},
        'endDate': {ISO 8601 date},
        'signedUp': {boolean},
        'manager': {name of the manager},
        'name': {name of the shift},
        'nbResponsibles': {integer},
        'nbVolunteers': {integer},
        'startDate': {ISO 8601 date},
        'location': {
            'id': {the location id},
            'latitude': {the latitude},
            'longitude': {the longitude},
            'name': {the location name},
        },
        'unit': {
            'id': {the unit id},
            'name': {the unit name},
        }
    }
]

Responsible POST request

{
    'access_token': {access token},
    'id': {the id of the shift},
}

Volunteer POST request

{
    'access_token': {access token},
    'id': {the id of the shift},
}

SignOut POST request

{
    'access_token': {access token},
    'id': {the id of the shift},
}