API documentation

Section

Section Translation

Section

GET: /section/:id

Takes in an id (ObjectId) and returns a SectionDoc correspondent to that id.

GET: /section/?text

Takes in a query text (string) and returns a list of SectionDoc, corresponding to a split of "text" into sections. Section order obeys the original text's order.

Section Translation

GET: /sectionTranslation/:section

Takes in the id of a section and returns all section translations associated with it. The return object is an array of PayloadSectionTranslation's. If the author of a section translation was deleted, returns the username as "Deleted user".

POST: /sectionTranslation

query: {
  id: ObjectId,
  translation: string
}

If there isn't a section corresponding to "id", raises an error. Otherwise, creates a new section translation that points to that section with text "translation".

PATCH: /sectionTranslation

query: {
  id: ObjectId,
  translation: string
}

If there isn't a section translation corresponding to "id", raises an error. If the user requesting an update isn't the owner of the translation, raises an error. Otherwise, updates the section translation's associated translation.

DELETE: /sectionTranslation

query: {
  id: ObjectId,
}

If there isn't a section translation corresponding to "id", raises an error. If the user requesting the deletion isn't the owner of the translation, raises an error. Otherwise, deletes the section translation.