Skip to content

Latest commit

 

History

History
519 lines (253 loc) · 11.3 KB

documentation.md

File metadata and controls

519 lines (253 loc) · 11.3 KB

📋 This Page documents the APIs provided by Shiftlog

Shiftlog features a set of APIs to easily create, manage, and publish Release Notes for your apps/products. The APIs are divided into 4 major parts:

1. 🔐 Auth

As the name suggests, these endpoints are used for all Authentication related stuff.

  • 📝 /api/createAccount

    Used to create a new account.

    TYPE: GET

    Headers:

    • 🔒 NONE

    Parameters:

    • username: string

    • password: string

    Response:

    • BadRequest (400): Empty parameters in Request Body

    • BadRequest (400): Illegal username or password!

    • ⚠️ Conflict (409): Username Already Exists

    • OK (200): {username: "<username>", authToken: "<authToken>"}

  • 🗑️ /api/deleteAccount

    Used to delete an existing account.

    TYPE: DELETE

    Headers:

    • 🔑 Authorization Bearer : authToken

    Parameters:

    • 🔒 NONE

    Response:

    • 🚫 Unauthorized (401): Auth token missing!

    • 🚫 Unauthorized (401): Invalid Auth Token

    • OK (200): User Account Deleted Successfully!

  • ✏️ /api/updateUsername

    Used to update the username of an account.

    TYPE: PUT

    Headers:

    • 🔑 Authorization Bearer : authToken

    Parameters:

    • newUsername: string

    Response:

    • 🚫 Unauthorized (401): Auth token missing!

    • 🚫 Unauthorized (401): Invalid Auth Token

    • BadRequest (400): Empty parameters in Request Body

    • BadRequest (400): Illegal username provided!

    • ⚠️ Conflict (409): This username is already taken!

    • OK (200): Username updated successfully!

  • 🔑 /api/updatePassword

    Used to update the password of an account.

    TYPE: PUT

    Headers:

    • 🔑 Authorization Bearer : authToken

    Parameters:

    newPassword: string

    Response:

    • 🚫 Unauthorized (401): Auth token missing!

    • 🚫 Unauthorized (401): Invalid Auth Token

    • BadRequest (400): Empty parameters in Request Body

    • BadRequest (400): Password contain illegal charachters!

    • ⚠️ Conflict (409): New Password cannot be same as old Password!

    • OK (200): {authToken: <authToken>}

  • 🔑 /api/login

    Used to login to an existing account.

    TYPE: POST

    Headers:

    • 🔒 NONE

    Parameters:

    username: string

    password: string

    Response:

    • BadRequest (400): Empty parameters in Request Body

    • BadRequest (400): Illegal username or password!

    • ⚠️ Conflict (409): Username does not exist!

    • 🚫 Unauthorized (401): Invalid login credentials!

    • OK (200): {username: "<username>", authToken: <authToken>}

  • 🚪 /api/logout

    Used to logout an account.

    TYPE: GET

    Headers:

    • 🔑 Authorization Bearer : authToken

    Parameters:

    • 🔒 NONE

    Response:

    • 🚫 Unauthorized (401): Auth token missing!

    • 🚫 Unauthorized (401): Invalid Auth Token

    • OK (200): Logged out!

2. 📊 Dashboard

These endpoints are typically to be consumed by the Dashboard of a frontend, hence they are classified as Dashboard APIs.

  • 📥 /api/getApps

    Used to get list of all apps of a user.

    TYPE: GET

    Headers:

    • 🔑 Authorization Bearer : authToken

    Parameters:

    • 🔒 NONE

    Response:

    • 🚫 Unauthorized (401): Auth token missing!

    • 🚫 Unauthorized (401): Invalid Auth Token

    • OK (200): [{id:<id>, name: <name>, hidden: [true/false], createdAt: <timestamp>, updatedAt: <timestamp>}, ...]

  • /api/createApp

    Used to create a new app for a user.

    TYPE: POST

    Headers:

    • 🔑 Authorization Bearer : authToken

    Parameters:

    • appName: string

    Response:

    • 🚫 Unauthorized (401): Auth token missing!

    • 🚫 Unauthorized (401): Invalid Auth Token

    • BadRequest (400): Empty app Name is not allowed.

    • BadRequest (400): Illegal app Name

    • OK (200): {id:<id>, name: <name>, hidden: [true/false], createdAt: <timestamp>, updatedAt: <timestamp>}

  • 🗑️ /api/deleteApp

    Used to delete an app of a user.

    TYPE: DELETE

    Headers:

    • 🔑 Authorization Bearer : authToken

    Parameters:

    • appId: int

    Response:

    • 🚫 Unauthorized (401): Auth token missing!

    • 🚫 Unauthorized (401): Invalid Auth Token

    • BadRequest (400): appId must be an Integer.

    • BadRequest (400): Illegal app Id

    • 🚫 Unauthorized (401): Unauthorized deletion!

    • OK (200): App deleted successfully!

  • ✏️ /api/updateApp

    Used to delete an app of a user.

    TYPE: PUT

    Headers:

    • 🔑 Authorization Bearer : authToken

    Parameters:

    • appId: int
    • name: string
    • hidden: int

    Response:

    • 🚫 Unauthorized (401): Auth token missing!

    • 🚫 Unauthorized (401): Invalid Auth Token

    • BadRequest (400): Empty parameters in Request Body

    • BadRequest (400): Illegal values provided!

    • BadRequest (400): Hiddden parameter must have a 'true' or 'false' value

    • BadRequest (400): appId must be an Integer.

    • 🚫 Unauthorized (401): Unauthorized update!

    • OK (200): App updated successfully!

3. 📱 App

These are App-specific APIs, typically used to present an "App page" by a frontend, hence the classification.

  • 🔄 /api/getReleases

    Used to get Releases of an App.

    TYPE: GET

    Headers:

    • 🔑 Authorization Bearer : authToken

    Parameters:

    • appId: int

    Response:

    • 🚫 Unauthorized (401): Auth token missing!

    • 🚫 Unauthorized (401): Invalid Auth Token

    • BadRequest (400): Illegal app Id

    • BadRequest (400): App ID must be an Integer.

    • 🚫 Unauthorized (401): Unauthorized access!

    • OK (200): [{id:<id>, appId: <appId>, versionCode: <code>, versionName: <name>, notesTxt: <txt>, notesMd: <md>, notesHtml: <html>, data: <stringData>, hidden: [true/false], createdAt: <timestamp>, updatedAt: <timestamp>}, ...]

  • /api/createReleases

    Used to create a new Release of an App.

    TYPE: POST

    Headers:

    • 🔑 Authorization Bearer : authToken

    Parameters:

    • appId: int
    • versionName: string
    • versionCode: int

    Response:

    • 🚫 Unauthorized (401): Auth token missing!

    • 🚫 Unauthorized (401): Invalid Auth Token

    • BadRequest (400): Illegal input parameter values

    • BadRequest (400): App ID must be an integer

    • BadRequest (400): Version Code must be an integer

    • BadRequest (400): Empty Version Name is not allowed.

    • BadRequest (400): This Version Code already exists

    • 🚫 Unauthorized (401): Unauthorized Request!

    • OK (200): {id:<id>, appId: <appId>, versionCode: <code>, versionName: <name>, notesTxt: <txt>, notesMd: <md>, notesHtml: <html>, data: <stringData>, hidden: [true/false], createdAt: <timestamp>, updatedAt: <timestamp>}

  • 🗑️ /api/deleteRelease

    Used to delete an existing Release of an App.

    TYPE: DELETE

    Headers:

    • 🔑 Authorization Bearer : authToken

    Parameters:

    • releaseId: int

    Response:

    • 🚫 Unauthorized (401): Auth token missing!

    • 🚫 Unauthorized (401): Invalid Auth Token

    • BadRequest (400): Illegal Release Id

    • BadRequest (400): releaseId must be an Integer.

    • 🚫 Unauthorized (401): Delete Request Unauthorized!

    • OK (200): Release deleted successfully!

  • ✏️ /api/updateRelease

    Used to update details of a Release.

    TYPE: PUT

    Headers:

    • 🔑 Authorization Bearer : authToken

    Parameters:

    • releaseId: int
    • versionName: string
    • versionCode: int
    • hidden: int
    • data: string

    Response:

    • 🚫 Unauthorized (401): Auth token missing!

    • 🚫 Unauthorized (401): Invalid Auth Token

    • BadRequest (400): Empty parameters in Request Body

    • BadRequest (400): Illegal values provided!

    • BadRequest (400): Hiddden parameter must have a 'true' or 'false' value

    • BadRequest (400): Release Id must be an Integer.

    • BadRequest (400): Version Code must be an Integer.

    • 🚫 Unauthorized (401): Unauthorized update!

    • OK (200): Release Details updated successfully!

4. 🚀 Release

These endpoints are Release-specific, in the manner that they are concerned about managing and publishing of a specific Release.

  • 📖 /api/getReleaseNotes [Unprotected Endpoint]

    Used to get Release Notes for a Release.

    NOTE: This endpointis an unprotected endpoint, i.e, no authentication is required to access it.

    This API supports fetching Release Notes via 2 methods, ordered by precedence:

    1. Directly by Release ID
    2. By App ID and Version Code (Note that you can also use the "latest" keyword in versionCode to automatically select the Release with the highest Version Code for given appId)

    TYPE: GET

    Headers:

    • 🔒 NONE

    Parameters:

    • releaseId: int
    • appId: int
    • versionCode: int
    • hidden: int
    • data: string

    Response:

    • BadRequest (400): Missing Parameters!

    • BadRequest (400): Illegal Release ID

    • BadRequest (400): Release ID must be an Integer!

    • BadRequest (400): Illegal App ID or Version Code

    • BadRequest (400): App ID must be an Integer!

    • BadRequest (400): Invalid Version Code

    • NotFound (404): Release Notes not found!

    • OK (200): {versionCode: <code>, versionName: <name>, notesTxt: <txt>, notesMd: <md>, notesHtml: <html>, updatedAt: <timestamp>}

  • ✏️ /api/updateReleaseNotes

    Used to update Release Notes of a Release.

    TYPE: PUT

    Headers:

    • 🔑 Authorization Bearer : authToken

    Parameters:

    • releaseId: int
    • notesTxt: string
    • notesMd: string
    • notesHtml: string

    Response:

    • 🚫 Unauthorized (401): Auth token missing!

    • 🚫 Unauthorized (401): Invalid Auth Token

    • BadRequest (400): Missing Release ID

    • BadRequest (400): Illegal values for Release ID provided!

    • BadRequest (400): Release Id must be an Integer.

    • 🚫 Unauthorized (401): Unauthorized update!

    • OK (200): Release Notes updated successfully!