Skip to content

API documentation

AuxiliumCDNG edited this page Dec 27, 2021 · 2 revisions

Introduction and explanation

BulletFlask is based on locations and types. Objects will be layed out according to their type. Object will appear in a place according to their location. This allows for great flexibility since every object may contain every other object. This is also practical for adding more features...

An explanation of the endpoints

Creating content

GET /api/content/create/<parameters>

parameters:

  • type
  • location
  • name
  • content (if type is not category)

returns either:

  • "success", 201 (If succeeded)
  • "missing permissions", 403
  • "Unknown Type", 400
  • [error while checking permissions], 500

Fetching content

GET /api/content/get/<parameters>

parameters:

  • location
  • breadcrumb? (may be used to return data for breadcrumb generation)
  • version? (may be used to specify a version of an element)

returns either:

  • "location not found", 404 (if location wasn't found in db)
  • tuple (may be an error)
  • json formatted contents (regular output): {"current": {...}, "contents": [ {...}, {...}... ] }

Moderating content

GET /api/content/versions/<parameters>

parameters:

  • location

returns:

  • A list of available versions of the element: [ {...data like current from get...}, {...}, ... ]

GET /api/content/moderate/delete/<parameters>

parameters:

  • id (the id of an element to delete)

returns either:

  • Code 406 (if you wanted to delete forum root with the id 0)
  • "missing permissions", 403
  • {"message": "success", "redirect": ...the location of the parent element...}, 200

GET /api/content/moderate/cut/<parameters>

This endpoint is used to move an element to another location. You firstly cut it with this endpoint and then paste it with the next endpoint. parameters:

  • id (the id of an element to cut)

returns either:

  • Code 406 (if you wanted to delete forum root with the id 0)
  • "missing permissions", 403
  • {"message": "success", "redirect": ...the location of the element...}, 200

GET /api/content/moderate/paste/<parameters>

Use this endpoint to paste the cut element. parameters:

  • target (the location to put the cut element)

returns either:

  • "no element cut", 412
  • Code 406 (if you wanted to delete forum root with the id 0)
  • "missing permissions", 403
  • {"message": "success", "redirect": ...the location of the element...}, 200

GET /api/content/moderate/edit/<parameters>

parameters:

  • id (id of the element to edit)
  • name (new name of the element; may be the same)
  • content (new content of the element; may be the same; only if type is not category)

returns either:

  • "missing permissions", 403
  • {"message": "success", "redirect": ...the location of the element...}, 200