Get started

API Endpoint

    https://a1.leos.lk/api/
                

The PortalOne APIs are to use the services of PortalOne of Leo District 306 A1, Sri Lanka.

These APIs use the latest OAuth2 Secure API Framework to its API implementation. APIs are free to use with any kind of web or mobile application. Special API key is not required to use the APIs. Therefore, developers can easilly start using APIs for their developments.

All APIs are basically devided into two categories as Authentication-required APIs and Authentication-not-required APIs. Users should use their PortalOne email and password to complete the authentication process.

For any clarification regarding the APIs, contact the developer via +94717290440.

Authentication


# Here is authentication URL example

    https://a1.leos.lk/api/login?email=example@abc.com&password=12345
                

Authentication is required to use most of the APIs here. To get the authentication, user email and password are required.

Authentication (Log In) URL:
https://a1.leos.lk/api/login


Users need the access token to log out. Log in will not expire until user logs out. Access token should be used as a Bearer Token in the HTTP request header.

Log Out URL:
https://a1.leos.lk/api/logout



Result example :

{
    "leo": {
        "leo_id": 1969,
        "leo_name": "Malinda Ganewatte",
        "leo_mylci": "4886456",
        "leo_email": "ganewattem21@gmail.com",
        "leo_address": "No.315, Usella Road, Maggona",
        "leo_contact": "772133525",
        "leo_birthday": "1992-08-17",
        "leo_gender": "Male",
        "leo_is_district_officer": "1",
        "leo_district_officer_level": "1",
        "leo_district_designation": "District President",
        "leo_is_club_officer": "0",
        "leo_club_officer_level": "0",
        "leo_designation_if_club_director": null,
        "leo_since": "2020-01-01",
        "leo_school": null,
        "leo_fb": null,
        "leo_insta": null,
        "leo_is_active": "1",
        "leo_image": "Base64 code here..."
    },
    "access_token": "access token here. This is used with authentication-required APIs"
}
                

PARAMETERS

Parameter Type Description
Method POST Route method should be POST
Return JSON JSON Array of Objects
Success Code 200 Receives after successfully complete the request.
Fail Code 422 Invalid credentials

Variables

JSON responses contain many variables and they have different meanings. This guide help you understanding them.

VARIABLE LIST

Variable Variable Type Description
leo_id Integer Leo's ID in the system
leo_name String Leo's full name in the system
leo_mylci Integer Leo's MyLCI Number
leo_email String Leo's email address
leo_address String Leo's full address in the system
leo_contact Integer Leo's contact number
leo_birthday Date Leo's birthday. Format "YYYY-MM-DD"
leo_gender String Leo's gender. (Male/Female)
leo_since Date Leo's joined date with the movement. Format "YYYY-MM-DD"
leo_school String Leo's school
leo_fb String Leo's facebook account URL
leo_insta String Leo's instagram account URL
leo_image String Leo's profile picture in Base64 format
leo_is_district_officer Interger Returns 1 if Leo is in District Council, else if returns 0
leo_district_officer_level Integer Leo's district council user account type.
1: Admin level
2: Exco level
3: Council level
leo_district_designation String Leo's designation in the District Council. Returns null if not applicable.
leo_is_club_officer Integer Returns 1 if Leo is a Club President, Club Vice President, Club Secretary or Club Treasurer,
returns 2 if Leo is a Club Director, else if returns 0.
leo_club_officer_level Integer Returns,
1: Club President
2: Club Vice President
3: Club Secretary
4: Club Treasurer
leo_designation_if_club_director String Director position in the club if Leo is a Club Director
leo_is_active Integer Returns 1 if Leo is an active member, else if returns 0
club_id String Leo Club ID in the system
club_name String Leo Club name in the system
club_email String Leo Club email in the system
club_type String Leo Club type. (Omega/Alpha)
club_region Char Region which Leo Club belongs to. (A, B, C & D)
club_start_date Date Leo Club charter date
club_logo String Leo Club logo in Base64 format
notification_id Integer Notification ID in the system
notification_description String Notification body
notification_url String Notification referring URL. Returns Null if not available.
notification_sender String Who owns the notification. Ex: District President
notification_type String Notification type. Ex: System Notification
notification_date DateTime Creation time of the notification

Club Data


# Here is URL example

    https://a1.leos.lk/api/getAllClubs
    https://a1.leos.lk/api/getOneClub/club_id=19
                

Authentication is not required to use below APIs.

To get a full club list:
http://a1.leos.lk/api/getAllClubs

To get details of a specific club:
http://a1.leos.lk/api/getOneClub/club_id=[club ID]



Result example :

{
    "club_id": "19",
    "club_name": "Colombo (Host)",
    "club_email": "leoclubcolombo@gmail.com",
    "club_type": "Omega",
    "club_region": "A",
    "club_start_date": "2005-01-01",
    "club_logo": "Base64 code here"
}
                

PARAMETERS

Parameter Type Description
Method GET Route method should be GET
Return JSON JSON Array of Objects
Success Code 200 Receives after successfully complete the request.
Fail Code 404 Leo Club does not exist
Authentication - Not Required

Council Data


# Here is URL example

    https://a1.leos.lk/api/getCouncil
                

Authentication is not required to use below API.

To get a full list of district council members:
https://a1.leos.lk/api/getCouncil



Result example :

[
    {
        "leo_id": "1969",
        "leo_name": "Malinda Ganewatte",
        "leo_mylci": "4886456",
        "leo_email": "ganewattem21@gmail.com",
        "leo_address": "No.315, Usella Road, Maggona",
        "leo_contact": "772133525",
        "leo_birthday": "1992-08-17",
        "leo_gender": "Male",
        "leo_district_designation": "District President",
        "leo_since": "2020-01-01",
        "leo_school": null,
        "leo_fb": null,
        "leo_insta": null,
        "leo_is_active": "1",
        "leo_image": "Base64 code here..."
    },
    {....Other memebers..} 
]
                

PARAMETERS

Parameter Type Description
Method GET Route method should be GET
Return JSON JSON Array of Objects
Success Code 200 Receives after successfully complete the request.
Authentication - Not Required

Leo's Data


# Here is URL example

    https://a1.leos.lk/api/getLeo/mylci=4886456
                

Authentication is not required to use below API.

To get full details of a Leo:
http://a1.leos.lk/api/getLeo/mylci=[MyLCI number]



Result example :

{
    "leo_id": 1969,
    "leo_name": "Malinda Ganewatte",
    "leo_mylci": "4886456",
    "leo_email": "ganewattem21@gmail.com",
    "leo_address": "No.315, Usella Road, Maggona",
    "leo_contact": "772133525",
    "leo_birthday": "1992-08-17",
    "leo_gender": "Male",
    "leo_is_district_officer": "1",
    "leo_district_officer_level": "1",
    "leo_district_designation": "District President",
    "leo_is_club_officer": "0",
    "leo_club_officer_level": "0",
    "leo_designation_if_club_director": null,
    "leo_since": "2020-01-01",
    "leo_school": null,
    "leo_fb": null,
    "leo_insta": null,
    "leo_is_active": "1",
    "leo_image": "Base64 code here..."
}
                

PARAMETERS

Parameter Type Description
Method GET Route method should be GET
Return JSON JSON Array of Objects
Success Code 200 Receives after successfully complete the request.
Fail Code 404 A Leo was not found.
Authentication - Not Required

Notifications


# Here is URL example

    https://a1.leos.lk/api/notifications/new
    https://a1.leos.lk/api/notifications/all
                

Authentication is required to use below APIs. Access token should be used as a Bearer Token in the HTTP request header to get authentication.

To get all the notifications which was generated after the last notification view of the user:
https://a1.leos.lk/api/notifications/new


To get all the notifications:
https://a1.leos.lk/api/notifications/all



Result example :

{
    "notifications": [
        {
            "notification_id": 3005,
            "notification_description": "A new event - "The Braille" was added by Leo Club of Moratuwa",
            "notification_url": "https://a1.leos.lk/en/event/view/id=206",
            "notification_sender": "Leo Club",
            "notification_type": "Event Notification",
            "notification_date": "2021-01-23T07:01:41.000000Z"
        },
        {
            ...
        },
    ]
}
                

PARAMETERS

Parameter Type Description
Method POST Route method should be POST
Return JSON JSON Array of Objects
Success Code 200 Receives after successfully complete the request.
Authentication - Required

Calendar


# Here is URL example

    https://a1.leos.lk/api/calendar/public
    https://a1.leos.lk/api/calendar/personal
                

Authentication is required to get the personal calendar only. Access token should be used as a Bearer Token in the HTTP request header to get authentication.

To get the public calendar (Only events):
https://a1.leos.lk/api/calendar/public

To get the personal calendar (Events & Meetings):
https://a1.leos.lk/api/calendar/personal



Result example :

{
    "events": [
        [
            "51st Installation Ceremony - Leo Club of Colombo (Host)",
            "2020-07-25",
            "58",
            "2",
            "https://a1.leos.lk/en/event/view/id=58"
        ],
        [
            ...
        ]
    ],
    "meetings": [
        [
            "Monthly General Meeting",
            "2020-11-15 18:00:00",
            "58",
            "https://a1.leos.lk/en/meeting/view/id=58"
        ],
        [
            ...
        ]
    ]
}
                

PARAMETERS

Parameter Type Description
Method GET Route method should be GET
Return JSON JSON Multidimensional Array
Success Code 200 Receives after successfully complete the request.
Authentication - Required for personal calendar

Public calendar output gives as: [Event Name, Event Date, Event ID, Event Type (1 - District Event, 2 - Club Event), Event URL]

Personal calendar output gives as:
Events: [Event Name, Event Date, Event ID, Event Type (1 - District Event, 2 - Club Event), Event URL]
Meetings: [Meeting Title, Meeting Date & Time (Ex: 2020-11-15 18:00:00), Meeting ID, Meeting URL]

Errors

The PortalOne API uses the following error codes:

Error Code Meaning
404 Resource not found or page not found.
422 Bad request. Incorrect credentials.
500 Internal server error.

Copyright @ Leo District 306 A1, Sri Lanka
Documented by ashKaNet