openapi: 3.0.0
info:
  description: |
    Welcome to the HumHub content module API reference.
  version: 1.0.0
  title: HumHub - Content API
  contact:
    email: info@humhub.com
  license:
    name: AGPLv2
    url: https://www.humhub.org/en/licences
tags:
  - name: Content
    description: API to access and manage content information.
    externalDocs:
      description: Find out more
      url: http://docs.humhub.org
  - name: Container
    description: API to access and manage content containers.
    externalDocs:
      description: Find out more
      url: http://docs.humhub.org
  - name: Tags
    description: Group API
components:
  securitySchemes:
    _ref: common.yaml#/securityDefinitions
  schemas:
    Content:
      type: object
      properties:
        metadata:
          $ref: "#/components/schemas/ContentMetadata"
        comments:
          type: object
          readOnly: true
          allOf:
            - $ref: comment.yaml#/components/schemas/CommentsSummary
        likes:
          type: object
          readOnly: true
          allOf:
            - $ref: like.yaml#/components/schemas/LikesSummary
        files:
          type: object
          readOnly: true
          allOf:
            - $ref: file.yaml#/components/schemas/Files
        topics:
          type: array
          items:
            $ref: "#/components/schemas/Topic"
    ContentMetadata:
      type: object
      properties:
        id:
          type: integer
          format: int64
          readOnly: true
          example: 14
        guid:
          type: string
          readOnly: true
          example: cd081891-d2e2-40d5-84a4-b47309e71c80
        object_model:
          type: string
          readOnly: true
          example: humhub\modules\post\models\Post
        object_id:
          type: integer
          format: int64
          readOnly: true
          example: 12
        visibility:
          type: integer
          format: int64
          example: 1
        state:
          type: integer
          format: int64
          minimum: 0
          maximum: 2
          example: 1
        archived:
          type: boolean
          example: true
        hidden:
          type: boolean
          example: true
        pinned:
          type: boolean
          example: false
        locked_comments:
          type: boolean
          example: false
        scheduled_at:
          type: string
          example: 2023-09-14 05:15:00
        created_by:
          readOnly: true
          allOf:
            - $ref: user.yaml#/components/schemas/UserShort
        created_at:
          type: string
          example: 2022-04-13 05:15:43
        updated_by:
          readOnly: true
          allOf:
            - $ref: user.yaml#/components/schemas/UserShort
        updated_at:
          type: string
          readOnly: true
          example: 2022-05-21 06:20:18
        url:
          type: string
          readOnly: true
          example: http://localhost/p/humhub/master/content/perma?id=109
        contentcontainer_id:
          type: integer
          readOnly: true
          format: int64
          example: 5
        stream_channel:
          type: string
          readOnly: true
          example: default
    Topic:
      type: object
      properties:
        id:
          type: integer
          format: int64
          readOnly: true
          example: 135
        name:
          type: string
          example: News
    ContentContainer:
      type: object
      properties:
        id:
          type: integer
          format: int64
          readOnly: true
          example: 14
        guid:
          type: string
          readOnly: true
          example: cd081891-d2e2-40d5-84a4-b47309e71c80
        objectClass:
          type: string
          readOnly: true
          example: humhub\modules\user\models\User
        objectPk:
          type: integer
          format: int64
          readOnly: true
          example: 53
paths:
  /content/container:
    get:
      tags:
        - Container
      summary: Find all content container
      description: ""
      parameters:
        - $ref: common.yaml#/components/parameters/pageParam
        - $ref: common.yaml#/components/parameters/limitParam
      responses:
        "200":
          description: successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  total:
                    $ref: common.yaml#/components/schemas/totalProperty
                  page:
                    $ref: common.yaml#/components/schemas/pageProperty
                  pages:
                    $ref: common.yaml#/components/schemas/pagesProperty
                  links:
                    $ref: common.yaml#/components/schemas/linksProperty
                  results:
                    type: array
                    items:
                      $ref: "#/components/schemas/ContentContainer"
  "/content/findByContainer/{id}":
    get:
      tags:
        - Content
      summary: Find all content by container
      description: ""
      parameters:
        - name: id
          in: path
          description: The id of the content container
          required: true
          schema:
            type: integer
        - $ref: common.yaml#/components/parameters/pageParam
        - $ref: common.yaml#/components/parameters/limitParam
        - name: orderBy
          in: query
          required: false
          description: |
            Order by:
              * creationTime - Descending, from most recently created
              * lastUpdate - Descending, from last updated
          schema:
            type: string
            enum:
              - creationTime
              - lastUpdate
            default: creationTime
        - name: dateUpdatedFrom
          in: query
          examples:
            string:
              value: 2021-01-01 11:00:00
              summary: Value can be a date string.
            unix:
              value: 1609498800
              summary: Value can be a unix timestamp.
          description: Filter by latest update time from date.
          schema:
            type: string
        - name: dateUpdatedTo
          in: query
          examples:
            string:
              value: 2022-01-01 11:00:00
              summary: Value can be a date string.
            unix:
              value: 1641034800
              summary: Value can be a unix timestamp.
          description: Filter by latest update time until date.
          schema:
            type: string
      responses:
        "200":
          description: successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  total:
                    $ref: common.yaml#/components/schemas/totalProperty
                  page:
                    $ref: common.yaml#/components/schemas/pageProperty
                  pages:
                    $ref: common.yaml#/components/schemas/pagesProperty
                  links:
                    $ref: common.yaml#/components/schemas/linksProperty
                  results:
                    type: array
                    items:
                      $ref: "#/components/schemas/Content"
        "400":
          description: Invalid content container id supplied
        "404":
          description: Content container not found
  "/content/{id}":
    get:
      tags:
        - Content
      summary: Get content by id
      description: ""
      parameters:
        - name: id
          in: path
          description: The id of the content
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: successful operation
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Content"
        "400":
          description: Invalid content id supplied
        "404":
          description: Content not found
    delete:
      tags:
        - Content
      summary: Deletes a content by id
      parameters:
        - name: id
          in: path
          description: The id of content
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: successful operation
        "404":
          description: Content not found
servers:
  - url: /api/v1
