openapi: 3.0.1
info:
  title: Notes Rest Api
  description: Notes addon rest endpoints
  license:
    name: LGPL
    url: https://www.gnu.org/licenses/lgpl-3.0.en.html
  version: "1.0"
tags:
- name: /notes
  description: Managing notes
paths:
  /notes/contextsearch:
    get:
      tags:
      - /notes
      operationId: searchData
      parameters:
      - name: keyword
        in: query
        schema:
          type: string
      - name: limit
        in: query
        schema:
          type: integer
          format: int32
      - name: wikiType
        in: query
        schema:
          type: string
      - name: wikiOwner
        in: query
        schema:
          type: string
      - name: favorites
        in: query
        schema:
          type: boolean
      - name: tags
        in: query
        schema:
          type: array
          items:
            type: string
      - name: spaceId
        in: query
        description: Space id used to search notes of one space
        schema:
          type: array
          items:
            type: integer
            format: int64
      - name: isNotesTreeFilter
        in: query
        schema:
          type: boolean
      - name: sortField
        in: query
        description: Field to sort by
        schema:
          type: string
      - name: sortDirection
        in: query
        description: Sort order (asc or desc)
        schema:
          type: string
      responses:
        default:
          description: default response
          content:
            application/json: {}
  /notes/draftNote/{noteId}:
    get:
      tags:
      - /notes
      summary: Get draft note by id
      description: This returns the draft note if the authenticated user is the author
        of the draft.
      operationId: getDraftNoteById
      parameters:
      - name: noteId
        in: path
        description: Note id
        required: true
        schema:
          type: integer
          format: int64
      - name: lang
        in: query
        description: draft content language
        schema:
          type: string
      responses:
        "200":
          description: Request fulfilled
        "400":
          description: Invalid query input
        "403":
          description: Unauthorized operation
        "404":
          description: Resource not found
    delete:
      tags:
      - /notes
      summary: Delete note by note's params
      description: This deletes the note if the authenticated user has EDIT permissions.
      operationId: deleteDraftNote
      parameters:
      - name: noteId
        in: path
        description: Note id
        required: true
        schema:
          type: string
      responses:
        "200":
          description: Request fulfilled
        "400":
          description: Invalid query input
        "403":
          description: Unauthorized operation
        "404":
          description: Resource not found
  /notes/illustration/{noteId}:
    get:
      tags:
      - /notes
      summary: Gets a note featured image illustration by note Id
      description: Gets a note featured image illustration by note Id
      operationId: getFeaturedImageIllustration
      parameters:
      - name: noteId
        in: path
        description: target note id
        required: true
        schema:
          type: integer
          format: int64
      - name: isDraft
        in: query
        description: target version language
        required: true
        schema:
          type: boolean
      - name: lang
        in: query
        description: target version language
        required: true
        schema:
          type: string
      - name: size
        in: query
        description: Optional size parameter
        required: true
        schema:
          type: string
      - name: v
        in: query
        description: Optional last modified parameter
        schema:
          type: integer
          format: int64
      responses:
        "200":
          description: Request fulfilled
        "500":
          description: Internal server error
        "400":
          description: Invalid query input
        "404":
          description: Resource not found
  /notes/languages:
    get:
      tags:
      - /notes
      operationId: getAvailableLanguages
      parameters:
      - name: lang
        in: query
        schema:
          type: string
      responses:
        default:
          description: default response
          content:
            application/json: {}
  /notes/latestDraftNote/{noteId}:
    get:
      tags:
      - /notes
      summary: Get latest draft note of page
      description: This returns the latest draft of the note if the authenticated
        user is the author of the draft.
      operationId: getLatestDraftOfPage
      parameters:
      - name: noteId
        in: path
        description: Note id
        required: true
        schema:
          type: string
      - name: lang
        in: query
        description: draft content language
        schema:
          type: string
      responses:
        "200":
          description: Request fulfilled
        "400":
          description: Invalid query input
        "403":
          description: Unauthorized operation
        "404":
          description: Resource not found
  /notes/note:
    post:
      tags:
      - /notes
      summary: Add a new note
      description: This adds a new note.
      operationId: createNote
      requestBody:
        description: note object to be created
        content:
          '*/*':
            schema:
              $ref: '#/components/schemas/PageEntity'
        required: true
      responses:
        "200":
          description: Request fulfilled
        "400":
          description: Invalid query input
        "403":
          description: Unauthorized operation
        "404":
          description: Resource not found
  /notes/note/export/cancel/{exportId}:
    get:
      tags:
      - /notes
      summary: Export notes
      description: This cancel export.
      operationId: cancelExportNote
      parameters:
      - name: exportId
        in: path
        description: export id
        required: true
        schema:
          type: integer
          format: int32
      responses:
        "200":
          description: Request fulfilled
        "400":
          description: Invalid query input
        "403":
          description: Unauthorized operation
        "404":
          description: Resource not found
  /notes/note/export/status/{exportId}:
    get:
      tags:
      - /notes
      summary: Export notes
      description: This export selected notes and provide a zip file.
      operationId: getExportNoteStatus
      parameters:
      - name: exportId
        in: path
        description: export id
        required: true
        schema:
          type: integer
          format: int32
      responses:
        "200":
          description: Request fulfilled
        "400":
          description: Invalid query input
        "403":
          description: Unauthorized operation
        "404":
          description: Resource not found
  /notes/note/export/zip/{exportId}:
    get:
      tags:
      - /notes
      summary: Export notes
      description: This export selected notes and provide a zip file.
      operationId: getExportedZip
      parameters:
      - name: exportId
        in: path
        description: List of notes ids
        required: true
        schema:
          type: integer
          format: int32
      responses:
        "200":
          description: Request fulfilled
        "400":
          description: Invalid query input
        "403":
          description: Unauthorized operation
        "404":
          description: Resource not found
  /notes/note/export/{exportId}/{notes}:
    get:
      tags:
      - /notes
      summary: Export notes
      description: This export selected notes and provide a zip file.
      operationId: exportNote
      parameters:
      - name: notes
        in: path
        description: List of notes ids
        required: true
        schema:
          type: string
      - name: exportId
        in: path
        description: export ID
        required: true
        schema:
          type: integer
          format: int32
      - name: exportAll
        in: query
        description: exportAll
        schema:
          type: boolean
      responses:
        "200":
          description: Request fulfilled
        "400":
          description: Invalid query input
        "403":
          description: Unauthorized operation
        "404":
          description: Resource not found
  /notes/note/import/{noteId}/{uploadId}:
    post:
      tags:
      - /notes
      summary: Import notes from a zip file
      description: This import notes from defined zip file under given note.
      operationId: importNote
      parameters:
      - name: noteId
        in: path
        description: Note id
        required: true
        schema:
          type: string
      - name: uploadId
        in: path
        description: Upload id
        required: true
        schema:
          type: string
      - name: conflict
        in: query
        description: Conflict
        required: true
        schema:
          type: string
      responses:
        "200":
          description: Request fulfilled
        "400":
          description: Invalid query input
        "403":
          description: Unauthorized operation
        "404":
          description: Resource not found
  /notes/note/move/{noteId}/{destinationNoteId}:
    patch:
      tags:
      - /notes
      summary: Move note under the destination one
      description: This moves the note if the authenticated user has EDIT permissions.
      operationId: moveNote
      parameters:
      - name: noteId
        in: path
        description: Note id
        required: true
        schema:
          type: string
      - name: destinationNoteId
        in: path
        description: Destination Note id
        required: true
        schema:
          type: string
      responses:
        "200":
          description: Request fulfilled
        "400":
          description: Invalid query input
        "403":
          description: Unauthorized operation
        "404":
          description: Resource not found
  /notes/note/translation/{noteId}:
    get:
      tags:
      - /notes
      summary: Get available translation languages by page id
      description: This get gets the available translation languages by page id.
      operationId: getPageAvailableTranslationLanguages
      parameters:
      - name: noteId
        in: path
        description: Note id
        required: true
        schema:
          type: integer
          format: int64
      - name: withDrafts
        in: query
        schema:
          type: boolean
      responses:
        "200":
          description: Request fulfilled
        "400":
          description: Invalid query input
        "500":
          description: Server internal error
  /notes/note/translation/{noteId}/{lang}:
    delete:
      tags:
      - /notes
      summary: Delete translation by page id and language
      description: This deletes translation by page id and language
      operationId: deleteTranslations
      parameters:
      - name: noteId
        in: path
        description: Note id
        required: true
        schema:
          type: integer
          format: int64
      - name: lang
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: Request fulfilled
        "400":
          description: Invalid query input
        "500":
          description: Server internal error
  /notes/note/view/{noteId}:
    post:
      tags:
      - /notes
      summary: mark a note as viewed
      description: This marks a note as viewed.
      operationId: markNoteAsViewed
      parameters:
      - name: noteId
        in: path
        description: News id
        required: true
        schema:
          type: string
      - name: lang
        in: query
        description: News target lang
        schema:
          type: string
      responses:
        "200":
          description: Request fulfilled
        "401":
          description: User not authorized to get the note
        "500":
          description: Internal server error
  /notes/note/{noteBookType}/{noteBookOwner}/{noteId}:
    get:
      tags:
      - /notes
      summary: Get note by notes params
      description: This get the not if the authenticated user has permissions to view
        the objects linked to this note.
      operationId: getNote
      parameters:
      - name: noteBookType
        in: path
        description: NoteBook Type
        required: true
        schema:
          type: string
      - name: noteBookOwner
        in: path
        description: NoteBook Owner
        required: true
        schema:
          type: string
      - name: noteId
        in: path
        description: Note id
        required: true
        schema:
          type: string
      - name: source
        in: query
        description: source
        required: true
        schema:
          type: string
      - name: lang
        in: query
        description: note content language
        schema:
          type: string
      responses:
        "200":
          description: Request fulfilled
        "400":
          description: Invalid query input
        "403":
          description: Unauthorized operation
        "404":
          description: Resource not found
    put:
      tags:
      - /notes
      summary: Updates a specific note by note's params
      description: This updates the note if the authenticated user has UPDATE permissions.
      operationId: updateNote
      parameters:
      - name: noteBookType
        in: path
        description: NoteBook Type
        required: true
        schema:
          type: string
      - name: noteBookOwner
        in: path
        description: NoteBook Owner
        required: true
        schema:
          type: string
      - name: noteId
        in: path
        description: Note id
        required: true
        schema:
          type: string
      requestBody:
        description: note object to be updated
        content:
          '*/*':
            schema:
              $ref: '#/components/schemas/PageEntity'
        required: true
      responses:
        "200":
          description: Request fulfilled
        "400":
          description: Invalid query input
        "403":
          description: Unauthorized operation
        "404":
          description: Resource not found
    delete:
      tags:
      - /notes
      summary: Delete note by note's params
      description: This delets the note if the authenticated user has EDIT permissions.
      operationId: deleteNote
      parameters:
      - name: noteBookType
        in: path
        description: NoteBook Type
        required: true
        schema:
          type: string
      - name: noteBookOwner
        in: path
        description: NoteBook Owner
        required: true
        schema:
          type: string
      - name: noteId
        in: path
        description: Note id
        required: true
        schema:
          type: string
      responses:
        "200":
          description: Request fulfilled
        "400":
          description: Invalid query input
        "403":
          description: Unauthorized operation
        "404":
          description: Resource not found
  /notes/note/{noteId}:
    get:
      tags:
      - /notes
      summary: Get note by id
      description: This get the note if the authenticated user has permissions to
        view the objects linked to this note.
      operationId: getNoteById
      parameters:
      - name: noteId
        in: path
        description: Note id
        required: true
        schema:
          type: string
      - name: noteBookType
        in: query
        description: noteBookType
        schema:
          type: string
      - name: noteBookOwner
        in: query
        description: noteBookOwner
        schema:
          type: string
      - name: withChildren
        in: query
        description: withChildren
        schema:
          type: boolean
      - name: source
        in: query
        description: source
        schema:
          type: string
      - name: lang
        in: query
        description: note content language
        schema:
          type: string
      - name: includeDeleted
        in: query
        schema:
          type: boolean
          default: false
      responses:
        "200":
          description: Request fulfilled
        "400":
          description: Invalid query input
        "403":
          description: Unauthorized operation
        "404":
          description: Resource not found
    put:
      tags:
      - /notes
      summary: Updates a specific note by id
      description: This updates the note if the authenticated user has UPDATE permissions.
      operationId: updateNoteById
      parameters:
      - name: noteId
        in: path
        description: Note id
        required: true
        schema:
          type: string
      requestBody:
        description: note object to be updated
        content:
          '*/*':
            schema:
              $ref: '#/components/schemas/PageEntity'
        required: true
      responses:
        "200":
          description: Request fulfilled
        "400":
          description: Invalid query input
        "403":
          description: Unauthorized operation
        "404":
          description: Resource not found
    delete:
      tags:
      - /notes
      summary: Delete note by note's params
      description: This deletes the note if the authenticated user has EDIT permissions.
      operationId: deleteNoteById
      parameters:
      - name: noteId
        in: path
        description: Note id
        required: true
        schema:
          type: string
      responses:
        "200":
          description: Request fulfilled
        "400":
          description: Invalid query input
        "403":
          description: Unauthorized operation
        "404":
          description: Resource not found
  /notes/restore/{noteVersion}:
    put:
      tags:
      - /notes
      summary: Restore a specific note version by version id
      description: This restore the note if the authenticated user has UPDATE permissions.
      operationId: RestoreNoteVersion
      parameters:
      - name: noteVersion
        in: path
        description: Version Number
        required: true
        schema:
          type: string
      requestBody:
        description: note object to be updated
        content:
          '*/*':
            schema:
              $ref: '#/components/schemas/Page'
        required: true
      responses:
        "200":
          description: Request fulfilled
        "400":
          description: Invalid query input
        "403":
          description: Unauthorized operation
        "404":
          description: Resource not found
  /notes/saveDraft:
    post:
      tags:
      - /notes
      summary: Add or update a new note draft page
      description: This adds a new note draft page or updates an existing one.
      operationId: saveDraft
      requestBody:
        description: Note draft page object to be created
        content:
          '*/*':
            schema:
              $ref: '#/components/schemas/DraftPageEntity'
        required: true
      responses:
        "200":
          description: Request fulfilled
        "400":
          description: Invalid query input
        "403":
          description: Unauthorized operation
        "404":
          description: Resource not found
  /notes/tree/{treeType}/{noteType}:
    get:
      tags:
      - /notes
      summary: Get node's tree data
      description: Display the current tree of a noteBook based on is path
      operationId: getNoteTreeData
      parameters:
      - name: treeType
        in: path
        description: Tree of selected path children or all notes
        required: true
        schema:
          type: string
      - name: noteType
        in: path
        description: Tree of drafts or notes
        required: true
        schema:
          type: string
      - name: path
        in: query
        description: Note path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: Request fulfilled
        "400":
          description: Invalid query input
        "403":
          description: Unauthorized operation
        "404":
          description: Resource not found
  /notes/versions/{noteId}:
    get:
      tags:
      - /notes
      summary: Get versions of note by id
      description: This get the versions of a note if the authenticated user has permissions
        to view the objects linked to this note.
      operationId: getNoteVersions
      parameters:
      - name: noteId
        in: path
        description: Note id
        required: true
        schema:
          type: string
      - name: lang
        in: query
        description: versions content language
        schema:
          type: string
      responses:
        "200":
          description: Request fulfilled
        "400":
          description: Invalid query input
        "403":
          description: Unauthorized operation
        "404":
          description: Resource not found
components:
  schemas:
    BreadcrumbData:
      type: object
      properties:
        id:
          type: string
        noteId:
          type: string
        title:
          type: string
        wikiOwner:
          type: string
        wikiType:
          type: string
    DraftPageEntity:
      type: object
      properties:
        appName:
          type: string
        author:
          type: string
        content:
          type: string
        extensionDataUpdated:
          type: boolean
        id:
          type: string
        lang:
          type: string
        name:
          type: string
        newPage:
          type: boolean
        owner:
          type: string
        pageParentId:
          type: integer
          format: int64
        parentPageId:
          type: string
        parentPageName:
          type: string
        properties:
          $ref: '#/components/schemas/PagePropertiesEntity'
        syntax:
          type: string
        targetPageId:
          type: string
        title:
          type: string
        toBePublished:
          type: boolean
        url:
          type: string
        wikiOwner:
          type: string
        wikiType:
          type: string
    FeaturedImageEntity:
      type: object
      properties:
        altText:
          type: string
        id:
          type: integer
          format: int64
        lastUpdated:
          type: integer
          format: int64
        mimeType:
          type: string
        toDelete:
          type: boolean
        uploadId:
          type: string
    Metadata:
      type: object
      properties:
        audienceId:
          type: integer
          format: int64
        createdDate:
          type: integer
          format: int64
        creatorId:
          type: integer
          format: int64
        id:
          type: integer
          format: int64
        name:
          type: string
        properties:
          type: object
          additionalProperties:
            type: string
        type:
          $ref: '#/components/schemas/MetadataType'
        typeName:
          type: string
    MetadataItem:
      type: object
      properties:
        createdDate:
          type: integer
          format: int64
        creatorId:
          type: integer
          format: int64
        id:
          type: integer
          format: int64
        metadata:
          $ref: '#/components/schemas/Metadata'
        metadataTypeName:
          type: string
        object:
          $ref: '#/components/schemas/MetadataObject'
        objectId:
          type: string
        objectType:
          type: string
        parentObjectId:
          type: string
        properties:
          type: object
          additionalProperties:
            type: string
        spaceId:
          type: integer
          format: int64
        updatedDate:
          type: integer
          format: int64
    MetadataObject:
      type: object
      properties:
        id:
          type: string
        parentId:
          type: string
        spaceId:
          type: integer
          format: int64
        type:
          type: string
    MetadataType:
      type: object
      properties:
        id:
          type: integer
          format: int64
        name:
          type: string
    NoteFeaturedImage:
      type: object
      properties:
        altText:
          type: string
        fileInputStream:
          type: object
        fileName:
          type: string
        fileSize:
          type: integer
          format: int64
        id:
          type: integer
          format: int64
        lastUpdated:
          type: integer
          format: int64
        mimeType:
          type: string
        toDelete:
          type: boolean
        uploadId:
          type: string
    NotePageProperties:
      type: object
      properties:
        draft:
          type: boolean
        featuredImage:
          $ref: '#/components/schemas/NoteFeaturedImage'
        hideAuthor:
          type: boolean
        hideReaction:
          type: boolean
        noteId:
          type: integer
          format: int64
        summary:
          type: string
    Page:
      type: object
      properties:
        activityId:
          type: string
        appName:
          type: string
        attachmentObjectType:
          type: string
        author:
          type: string
        authorFullName:
          type: string
        breadcrumb:
          type: array
          items:
            $ref: '#/components/schemas/BreadcrumbData'
        canImport:
          type: boolean
        canManage:
          type: boolean
        canView:
          type: boolean
        children:
          type: array
          items:
            $ref: '#/components/schemas/Page'
        comment:
          type: string
        content:
          type: string
        createdDate:
          type: string
          format: date-time
        deleted:
          type: boolean
        draftPage:
          type: boolean
        hasChild:
          type: boolean
        id:
          type: string
        lang:
          type: string
        lastUpdater:
          type: string
        latestVersionId:
          type: string
        metadatas:
          type: object
          additionalProperties:
            type: array
            items:
              $ref: '#/components/schemas/MetadataItem'
        minorEdit:
          type: boolean
        name:
          type: string
        owner:
          type: string
        parent:
          $ref: '#/components/schemas/Page'
        parentPageId:
          type: string
        parentPageName:
          type: string
        properties:
          $ref: '#/components/schemas/NotePageProperties'
        syntax:
          type: string
        title:
          type: string
        toBePublished:
          type: boolean
        updatedDate:
          type: string
          format: date-time
        url:
          type: string
        wikiId:
          type: string
        wikiOwner:
          type: string
        wikiType:
          type: string
    PageEntity:
      type: object
      properties:
        appName:
          type: string
        author:
          type: string
        content:
          type: string
        extensionDataUpdated:
          type: boolean
        id:
          type: string
        lang:
          type: string
        name:
          type: string
        owner:
          type: string
        pageParentId:
          type: integer
          format: int64
        parentPageId:
          type: string
        parentPageName:
          type: string
        properties:
          $ref: '#/components/schemas/PagePropertiesEntity'
        syntax:
          type: string
        title:
          type: string
        toBePublished:
          type: boolean
        url:
          type: string
        wikiOwner:
          type: string
        wikiType:
          type: string
    PagePropertiesEntity:
      type: object
      properties:
        draft:
          type: boolean
        featuredImage:
          $ref: '#/components/schemas/FeaturedImageEntity'
        hideAuthor:
          type: boolean
        hideReaction:
          type: boolean
        noteId:
          type: integer
          format: int64
        summary:
          type: string
