Skip to content

Latest commit

 

History

History
631 lines (393 loc) · 16.9 KB

README.md

File metadata and controls

631 lines (393 loc) · 16.9 KB

PHP Client for the Kiron Partner API

Simple client for the Kiron Partner API to manage courses

Usage

Getting a valid token for authentification

A token for the test system can be created here:

https://uat-internal.kiron.ngo/backend/kiron/organization/partnerapitokens

A token for the production system can be created here:

https://internal.kiron.ngo/backend/kiron/organization/partnerapitokens

Example code

<?php

require_once 'KironPartnerAPIClient.php'; // Require class

$client = new KironPartnerAPIClient('tokenfrombackend', 'UAT'); // Init client
$client->createOrUpdateCourse('200', [
    'denomination' => 'Test Course',
    'ects' => 5,
    'link' => 'http://example.com/course',
    'language' => 'German',
    'startDateSemesterTwo' => '2020-12-10',
    'endDateSemesterTwo' => '2021-02-04',
])); // Create or update course, for attirbutes see below

$client->getSections(); // Returns array of all sections
$client->getCourses(); // Returns array of all courses
$client->getCourse('200'); // Returns coruse with id 200
$client->deleteCourse('200'); // Deletes course with id 200

Methods

public function __construct(string $token, string $env = 'UAT')

Params:

  • $token is a valid token obtained in the backend
  • $env is one of:
    • 'LOCAL' (Local development system of Kiron),
    • 'UAT' (Test System),
    • 'PROD' (Production system)

Returns client object

public function createOrUpdateCourse(string $id, array $attributes)

Params:

  • $id id of the course in the partner system (also called "externalId")
  • $attributes array of course attributes, see here for a description of all possible attributes

Returns response array:

  • If course was created: ['response' => 'Created course as JSON string', 'code' => 200, 'successful' => true]
  • If course was updated: ['response' => '', 'code' => 204, 'successful' => true]
  • On error ['response' => 'Error message', 'code' => (A number >= 400), 'successful' => false]

public function getSections()

No params

Returns list of sections with the following attributes:

  • id: Id of the section
  • denomination: Name of the section
  • path: Name of the category / name of the secion

public function getCourses()

No params

Returns list of courses with all attributes listed here and the id in the partner system as externalId

Throws an Exception when list cannot be found retrieved!

public function getCourse(string $id)

Params:

  • $id id of the course in the partner system (also called "externalId")

Returns course with the given id with all attributes listed here and given id as externalId

Throws an Exception when course cannot be found!

public function deleteCourse(string $id)

Params:

  • $id id of the course in the partner system (also called "externalId")

Returns response array:

  • If course was deleted: ['response' => '', 'code' => 204, 'successful' => true]
  • On error ['response' => 'Error message', 'code' => (A number >= 400), 'successful' => false]

Course Attributes

Property Type Required
denomination string Required
ects integer Required
workload number Optional
weeks integer Optional
link string Required
language string Required
sectionId integer Optional
courseLevel string Optional
certificateType string Optional
certificateCost string Optional
registrationDeadline string Optional
degreeLevel string Optional
yufeFocusArea string Optional
physicalOrVirtual string Optional
studyProgramYear string Optional
semesterOffered string Optional
startDateSemesterOne string Optional*
endDateSemesterOne string Optional*
startDateSemesterTwo string Optional*
endDateSemesterTwo string Optional*
courseExaminationType string Optional
availableSeats integer Optional
dublinDescriptors string Optional
admissionCriteria string Optional
courseCoordinator string Optional
shortDescription string Optional
longDescription string Optional
imageUrl string Optional
status string Optional

*Note that not all start and end dates are optional at the same time. At least one set of start and end dates must be provided for the first or second semester

denomination

The name of the course.

denomination

  • is required
  • Type: string
  • cannot be null
  • defined in: Course

denomination Type

string

ects

Amount of ECTS awarded for the completion of this course.

ects

  • is required
  • Type: integer
  • cannot be null
  • defined in: Course

ects Type

integer

workload

Estimated amount of hours of work needed to complete the course. Defaults to 30*ects if not provided.

workload

  • is optional
  • Type: number
  • cannot be null
  • defined in: Course

workload Type

number

weeks

How many weeks does this course run? Will be calculated from start and end dates if not provided

weeks

  • is optional
  • Type: integer
  • cannot be null
  • defined in: Course

weeks Type

integer

link

Link to this course in the partner LMS.

link

  • is required
  • Type: string
  • cannot be null
  • defined in: Course

link Type

string

link Constraints

URI: the string must be a URI, according to RFC 3986

language

The name of the language that is spoken in this course.

language

  • is required
  • Type: string
  • cannot be null
  • defined in: Course

language Type

string

sectionId

Id of the section this course is shown in.

sectionId

  • is optional
  • Type: integer
  • cannot be null
  • defined in: Course

sectionId Type

integer

courseLevel

Difficulty level of this course.

courseLevel

  • is optional
  • Type: string
  • cannot be null
  • defined in: Course

courseLevel Type

string

courseLevel Constraints

enum: the value of this property must be equal to one of the following values:

Value Explanation
"Introductory"
"Intermediate"
"Advanced"

certificateType

certificateType

  • is optional
  • Type: string
  • cannot be null
  • defined in: Course

certificateType Type

string

certificateType Constraints

enum: the value of this property must be equal to one of the following values:

Value Explanation
"None"
"Verified Certificate"
"Unverified Certificate"

certificateCost

Cost of the certificate.

certificateCost

  • is optional
  • Type: string
  • cannot be null
  • defined in: Course

certificateCost Type

string

certificateCost Constraints

enum: the value of this property must be equal to one of the following values:

Value Explanation
"Free"
"Paid"

registrationDeadline

Date and time, when the registration for this courses closes.

registrationDeadline

  • is optional
  • Type: string
  • cannot be null
  • defined in: Course

registrationDeadline Type

string

degreeLevel

The degree level of the course.

degreeLevel

  • is optional
  • Type: string
  • cannot be null
  • defined in: Course

degreeLevel Type

string

yufeFocusArea

yufeFocusArea

  • is optional
  • Type: string
  • cannot be null
  • defined in: Course

yufeFocusArea Type

string

physicalOrVirtual

Information about the mode of the course. Can be any descriptive string.

physicalOrVirtual

  • is optional
  • Type: string
  • cannot be null
  • defined in: Course

physicalOrVirtual Type

string

studyProgramYear

Which year should the students study this course.

studyProgramYear

  • is optional
  • Type: string
  • cannot be null
  • defined in: Course

studyProgramYear Type

string

semesterOffered

Semesters in which this course is offered.

semesterOffered

  • is optional
  • Type: string
  • cannot be null
  • defined in: Course

semesterOffered Type

string

startDateSemesterOne

Start date of the course in the first semester if applicable.

startDateSemesterOne

  • is optional
  • Type: string
  • cannot be null
  • defined in: Course

startDateSemesterOne Type

string

startDateSemesterOne Constraints

date: the string must be a date string, according to RFC 3339, section 5.6

endDateSemesterOne

End date of the course in the first semester if applicable.

endDateSemesterOne

  • is optional
  • Type: string
  • cannot be null
  • defined in: Course

endDateSemesterOne Type

string

endDateSemesterOne Constraints

date: the string must be a date string, according to RFC 3339, section 5.6

startDateSemesterTwo

Start date of the course in the second semester if applicable.

startDateSemesterTwo

  • is optional
  • Type: string
  • cannot be null
  • defined in: Course

startDateSemesterTwo Type

string

startDateSemesterTwo Constraints

date: the string must be a date string, according to RFC 3339, section 5.6

endDateSemesterTwo

End date of the course in the second semester if applicable.

endDateSemesterTwo

  • is optional
  • Type: string
  • cannot be null
  • defined in: Course

endDateSemesterTwo Type

string

endDateSemesterTwo Constraints

date: the string must be a date string, according to RFC 3339, section 5.6

courseExaminationType

courseExaminationType

  • is optional
  • Type: string
  • cannot be null
  • defined in: Course

courseExaminationType Type

string

availableSeats

Seats available for YUFE incomings (positive integer)

availableSeats

  • is optional
  • Type: integer
  • cannot be null
  • defined in: Course

availableSeats Type

integer

dublinDescriptors

Learning outcomes of this course

dublinDescriptors

  • is optional
  • Type: string
  • cannot be null
  • defined in: Course

dublinDescriptors Type

string

admissionCriteria

Requirements the students need to fulfill in order to study this course.

admissionCriteria

  • is optional
  • Type: string
  • cannot be null
  • defined in: Course

admissionCriteria Type

string

courseCoordinator

Person or institute responsible for running this course.

courseCoordinator

  • is optional
  • Type: string
  • cannot be null
  • defined in: Course

courseCoordinator Type

string

shortDescription

Optional description of the course.

shortDescription

  • is optional
  • Type: string
  • cannot be null
  • defined in: Course

shortDescription Type

string

longDescription

Optional longer description of the course.

longDescription

  • is optional
  • Type: string
  • cannot be null
  • defined in: Course

longDescription Type

string

imageUrl

URL of an image for the course.

imageUrl

  • is optional
  • Type: string
  • cannot be null
  • defined in: Course

imageUrl Type

string

imageUrl Constraints

URI: the string must be a URI, according to RFC 3986

status

Status of this course.

status

  • is optional
  • Type: string
  • cannot be null

status Type

string

status Constraints

enum: the value of this property must be equal to one of the following values:

Value Explanation
"new" Course not yet published on campus
"ready" Course visible on campus
"old" Only visible to students who are enrolled in the course