Skip to content

Auth.sch facing API

Gergely Dömők edited this page Dec 20, 2018 · 1 revision

Global rules

Every response is in JSON format.

Every response contains a "success" key that is either true or false.

If the "success" is false the response also contains a HTTP error code.

Routes

GET /services/sync/{id}

Get the basic profile of a user

Parameters:

  • id: Neptun code or auth.sch id of the user, the application guesses which one from the format and length

Returns:

  • success: true - if the user was found
    • user - wraps the user object
    • displayName - full name
    • mail
    • givenName - firstname
    • sn - lastname
    • eduPersonNickName - nick
    • uid - username
    • mobile
    • schacPersonalUniqueId - database id
  • success: false - error messages:
    • HTTP 400 "Not valid id. It should be a UUID or a NEPTUN code." - id format doesn't match neptun or auth.sch id format
    • HTTP 404 "Could not find user with {id} id." - missing id

Example request:

GET /services/sync/abc123

Example response:

{
    "success": true,
    "user": {
        "displayName": "Gulyás Gergely",
        "mail": "salierri@users.noreply.github.com",
        "givenName": "Gergely",
        "sn": "Gulyás",
        "eduPersonNickName": "Geri",
        "uid": "salierri",
        "mobile": "06701234123",
        "schacPersonalUniqueId": 12345
    }
}

GET /services/sync/{id}/memberships

Get all memberships of the given user

Parameters:

  • id: Neptun code or auth.sch id of the user, the application guesses which one from the format and length

Returns:

  • success: true - if the user was found
    • memberships - an array of the memberships
    • start - 2016-06-09 format
    • end - same format
    • group_name - official name
    • group_id - database id
    • posts - array of posts in string format (contains 'tag' if active member)
  • success: false - error messages:
    • HTTP 400 "Not valid id. It should be a UUID or a NEPTUN code." - id format doesn't match neptun or auth.sch id format
    • HTTP 404 "Could not find user with {id} id." - missing id

Example request:

GET /services/sync/abc123/memberships

Example response:

{
    "success": true,
    "memberships": [{
        "end": null,
        "posts": ["tag"],
        "start": "2013-06-09",
        "group_name": "Simonyi Károly Szakkollégium",
        "group_id": 16
    }, {
        "end": "2016-12-11",
        "posts": ["senior", "öregtag"],
        "start": "2012-12-05",
        "group_name": "Szent Schönherz Senior Lovagrend",
        "group_id": 18
    }]
}

GET /services/entrants/get/{semester}/{neptun}

Get all entrants assigned to a specific user in a specific semester

This route doesn't use the normal error messages, returns Jboss HTTP error messages instead

Parameters:

  • semester: given semester in '201720182' format where the last number is 1 or 2 based on the semester being autumn or spring respectively
  • neptun: neptun code of the user

Returns: An array of entrants

  • groupId - database id of a group
  • groupName - official name
  • entrantType - 'KDO', 'KB' or 'AB'

Example request:

GET /services/entrants/get/201420151/abc123

Example response:

[{
    "groupId": 106,
    "groupName": "KIR fejlesztők és üzemeltetők",
    "entrantType": "KDO"
}, {
    "groupId": 16,
    "groupName": "Simonyi Károly Szakkollégium",
    "entrantType": "KDO"
}]

GET /services/entrants/get/{semester}/authsch/{id}

Exact same as the last one, but expects auth.sch id for user identification

Pingback GET https://auth.sch.bme.hu/api/profile/resync?access_token={accesstoken}

Pingback every time a new user registers

Parameters:

  • accesstoken - access token obtained from auth.sch

Returns: HTTP code (200 if everything went well, others are unexpected errors)