Kong Snippets API

APIs related to Konnect Developer Portal Custom Snippets.

OpenAPI Specification

kong-snippets-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  contact:
    email: support@konghq.com
    name: Kong Inc
    url: https://konghq.com
  description: 'OpenAPI 3.0 spec for Kong Gateway''s Admin API.


    You can learn more about Kong Gateway at [developer.konghq.com](https://developer.konghq.com).

    Give Kong a star at the [Kong/kong](https://github.com/kong/kong) repository.'
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
  title: Kong Enterprise Admin ACLs Snippets API
  version: 3.14.0
servers:
- description: Default Admin API URL
  url: '{protocol}://{hostname}:{port}{path}'
  variables:
    hostname:
      default: localhost
      description: Hostname for Kong's Admin API
    path:
      default: /
      description: Base path for Kong's Admin API
    port:
      default: '8001'
      description: Port for Kong's Admin API
    protocol:
      default: http
      description: Protocol for requests to Kong's Admin API
      enum:
      - http
      - https
security:
- adminToken: []
tags:
- name: Snippets
  description: APIs related to Konnect Developer Portal Custom Snippets.
paths:
  /v3/portals/{portalId}/snippets:
    get:
      operationId: list-portal-snippets
      summary: List Snippets
      description: Returns the paginated list of custom snippets that have been created for this portal.
      parameters:
      - $ref: '#/components/parameters/SortPortalSnippets'
      - $ref: '#/components/parameters/PortalId'
      - $ref: '#/components/parameters/PageSize'
      - $ref: '#/components/parameters/PageNumber'
      - name: filter
        in: query
        description: Filter snippets returned in the response.
        required: false
        schema:
          $ref: '#/components/schemas/PortalSnippetsFilterParameters'
        style: deepObject
      responses:
        '200':
          $ref: '#/components/responses/ListPortalSnippets'
        '400':
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/BadRequestError'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
      tags:
      - Snippets
    post:
      x-speakeasy-entity-operation:
        terraform-resource: PortalSnippet#create
        terraform-datasource: null
      operationId: create-portal-snippet
      summary: Create Snippet
      description: Creates a new custom snippet for this portal. Custom snippets can be used to display static content, documentation, or other information to developers. Title and Description properties may be provided in the frontmatter section of `content`. If you set values in both the `POST` request _and_ in the frontmatter, the values in the frontmatter will take precedence.
      parameters:
      - $ref: '#/components/parameters/PortalId'
      requestBody:
        $ref: '#/components/requestBodies/CreatePortalSnippet'
      responses:
        '201':
          $ref: '#/components/responses/PortalSnippet'
        '400':
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/BadRequestError'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
      tags:
      - Snippets
  /v3/portals/{portalId}/snippets/{snippetId}:
    get:
      x-speakeasy-entity-operation:
        terraform-resource: PortalSnippet#read
        terraform-datasource: null
      operationId: get-portal-snippet
      summary: Get a Snippet
      description: Returns the configuration of a single custom snippet for this portal. Custom snippets can be used to display static content, documentation, or other information to developers.
      parameters:
      - $ref: '#/components/parameters/PortalId'
      - $ref: '#/components/parameters/SnippetId'
      responses:
        '200':
          $ref: '#/components/responses/PortalSnippet'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
      tags:
      - Snippets
    patch:
      x-speakeasy-entity-operation:
        terraform-resource: PortalSnippet#update
        terraform-datasource: null
      operationId: update-portal-snippet
      summary: Update Snippet
      description: Updates the configuration of a single custom snippet for this portal.
      parameters:
      - $ref: '#/components/parameters/PortalId'
      - $ref: '#/components/parameters/SnippetId'
      requestBody:
        $ref: '#/components/requestBodies/UpdatePortalSnippet'
      responses:
        '200':
          $ref: '#/components/responses/PortalSnippet'
        '400':
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/BadRequestError'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
      tags:
      - Snippets
    delete:
      x-speakeasy-entity-operation:
        terraform-resource: PortalSnippet#delete
        terraform-datasource: null
      operationId: delete-portal-snippet
      summary: Delete Snippet
      description: Deletes a single custom snippet for this portal.
      parameters:
      - $ref: '#/components/parameters/PortalId'
      - $ref: '#/components/parameters/SnippetId'
      responses:
        '204':
          description: No Content
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
      tags:
      - Snippets
components:
  schemas:
    InvalidParameterMinimumLength:
      type: object
      properties:
        field:
          type: string
          example: name
          readOnly: true
        rule:
          description: invalid parameters rules
          type: string
          enum:
          - min_length
          - min_digits
          - min_lowercase
          - min_uppercase
          - min_symbols
          - min_items
          - min
          nullable: false
          readOnly: true
          x-speakeasy-unknown-values: allow
        minimum:
          type: integer
          example: 8
        source:
          type: string
          example: body
        reason:
          type: string
          example: must have at least 8 characters
          readOnly: true
      additionalProperties: false
      required:
      - field
      - reason
      - rule
      - minimum
    PortalSnippetsFilterParameters:
      type: object
      properties:
        id:
          $ref: '#/components/schemas/UuidFieldFilter'
        name:
          $ref: '#/components/schemas/StringFieldFilter'
        title:
          $ref: '#/components/schemas/StringFieldFilter'
        visibility:
          $ref: '#/components/schemas/StringFieldFilter'
        created_at:
          $ref: '#/components/schemas/DateTimeFieldFilter'
        updated_at:
          $ref: '#/components/schemas/DateTimeFieldFilter'
      additionalProperties: false
      title: PortalSnippetsFilterParameters
    UpdatedAt:
      description: An ISO-8601 timestamp representation of entity update date.
      type: string
      format: date-time
      example: '2022-11-04T20:10:06.927Z'
      readOnly: true
      x-speakeasy-param-suppress-computed-diff: true
    InvalidParameterChoiceItem:
      type: object
      properties:
        field:
          type: string
          example: name
          readOnly: true
        rule:
          description: invalid parameters rules
          type: string
          enum:
          - enum
          nullable: false
          readOnly: true
        reason:
          type: string
          example: is a required field
          readOnly: true
        choices:
          type: array
          items: {}
          minItems: 1
          nullable: false
          readOnly: true
          uniqueItems: true
        source:
          type: string
          example: body
      additionalProperties: false
      required:
      - field
      - reason
      - rule
      - choices
    Description:
      type: string
      example: A custom page about developer portals
      maxLength: 160
      title: ResourceDescription
    InvalidParameterMaximumLength:
      type: object
      properties:
        field:
          type: string
          example: name
          readOnly: true
        rule:
          description: invalid parameters rules
          type: string
          enum:
          - max_length
          - max_items
          - max
          nullable: false
          readOnly: true
          x-speakeasy-unknown-values: allow
        maximum:
          type: integer
          example: 8
        source:
          type: string
          example: body
        reason:
          type: string
          example: must not have more than 8 characters
          readOnly: true
      additionalProperties: false
      required:
      - field
      - reason
      - rule
      - maximum
    SnippetVisibilityStatus:
      description: 'Whether a snippet is publicly accessible to non-authenticated users.

        If not provided, the default_page_visibility value of the portal will be used.

        '
      type: string
      example: public
      enum:
      - public
      - private
      title: PageVisibilityStatus
      x-speakeasy-unknown-values: allow
    UuidFieldFilter:
      description: 'Filter using **one** of the following operators: `eq`, `oeq`, `neq`'
      type: object
      properties:
        eq:
          description: The field exactly matches the provided value.
          type: string
        oeq:
          description: The field matches any of the provided values.
          type: string
        neq:
          description: The field does not match the provided value.
          type: string
      additionalProperties: false
    ListPortalSnippetsResponse:
      description: A paginated list of custom snippets in a portal.
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/PortalSnippetInfo'
        meta:
          $ref: '#/components/schemas/PaginatedMeta'
      example:
        data:
        - id: 437c7192-fea0-4f35-8478-c8d57783f8c1
          name: my-snippet
          title: My Snippet
          visibility: public
          status: published
          description: A custom snippet
          created_at: '2021-01-01T00:00:00Z'
          updated_at: '2021-01-01T00:00:00Z'
        meta:
          page:
            number: 1
            size: 10
            total: 1
      additionalProperties: false
      required:
      - data
      - meta
      title: ListPortalSnippetsResponse
    UUID:
      description: Contains a unique identifier used for this resource.
      type: string
      format: uuid
      example: 5f9fd312-a987-4628-b4c5-bb4f4fddd5f7
      readOnly: true
    ForbiddenError:
      allOf:
      - $ref: '#/components/schemas/BaseError'
      - type: object
        properties:
          status:
            example: 403
          title:
            example: Forbidden
          type:
            example: https://httpstatuses.com/403
          instance:
            example: kong:trace:1234567890
          detail:
            example: Forbidden
    UnauthorizedError:
      allOf:
      - $ref: '#/components/schemas/BaseError'
      - type: object
        properties:
          status:
            example: 401
          title:
            example: Unauthorized
          type:
            example: https://httpstatuses.com/401
          instance:
            example: kong:trace:1234567890
          detail:
            example: Invalid credentials
    PublishedStatus:
      description: Whether the resource is visible on a given portal. Defaults to unpublished.
      type: string
      example: published
      enum:
      - published
      - unpublished
      title: PublishedStatus
      x-speakeasy-unknown-values: allow
    SnippetName:
      description: The unique name of a snippet in a portal.
      type: string
      example: my-snippet
      maxLength: 512
      title: SnippetName
    PaginatedMeta:
      description: returns the pagination information
      type: object
      properties:
        page:
          $ref: '#/components/schemas/PageMeta'
      required:
      - page
      title: PaginatedMeta
      x-speakeasy-terraform-ignore: true
    StringFieldFilter:
      description: 'Filter using **one** of the following operators: `eq`, `oeq`, `neq`, `contains`, `ocontains`'
      type: object
      properties:
        eq:
          description: The field exactly matches the provided value.
          type: string
        contains:
          description: The field contains the provided value.
          type: string
        ocontains:
          description: The field contains any of the provided values.
          type: string
        oeq:
          description: The field matches any of the provided values.
          type: string
        neq:
          description: The field does not match the provided value.
          type: string
      additionalProperties: false
    CreatedAt:
      description: An ISO-8601 timestamp representation of entity creation date.
      type: string
      format: date-time
      example: '2022-11-04T20:10:06.927Z'
      readOnly: true
      x-speakeasy-param-suppress-computed-diff: true
    BaseError:
      description: standard error
      type: object
      properties:
        status:
          description: 'The HTTP status code of the error. Useful when passing the response

            body to child properties in a frontend UI. Must be returned as an integer.

            '
          type: integer
          readOnly: true
        title:
          description: 'A short, human-readable summary of the problem. It should not

            change between occurences of a problem, except for localization.

            Should be provided as "Sentence case" for direct use in the UI.

            '
          type: string
          readOnly: true
        type:
          description: The error type.
          type: string
          readOnly: true
        instance:
          description: 'Used to return the correlation ID back to the user, in the format

            kong:trace:<correlation_id>. This helps us find the relevant logs

            when a customer reports an issue.

            '
          type: string
          readOnly: true
        detail:
          description: 'A human readable explanation specific to this occurence of the problem.

            This field may contain request/entity data to help the user understand

            what went wrong. Enclose variable values in square brackets. Should be

            provided as "Sentence case" for direct use in the UI.

            '
          type: string
          readOnly: true
      required:
      - status
      - title
      - instance
      - detail
      title: Error
    InvalidParameterDependentItem:
      type: object
      properties:
        field:
          type: string
          example: name
          readOnly: true
        rule:
          description: invalid parameters rules
          type: string
          enum:
          - dependent_fields
          nullable: true
          readOnly: true
        reason:
          type: string
          example: is a required field
          readOnly: true
        dependents:
          type: array
          items: {}
          nullable: true
          readOnly: true
          uniqueItems: true
        source:
          type: string
          example: body
      additionalProperties: false
      required:
      - field
      - rule
      - reason
      - dependents
    InvalidRules:
      description: invalid parameters rules
      type: string
      enum:
      - required
      - is_array
      - is_base64
      - is_boolean
      - is_date_time
      - is_integer
      - is_null
      - is_number
      - is_object
      - is_string
      - is_uuid
      - is_fqdn
      - is_arn
      - unknown_property
      - missing_reference
      - is_label
      - matches_regex
      - invalid
      - is_supported_network_availability_zone_list
      - is_supported_network_cidr_block
      - is_supported_provider_region
      - type
      nullable: true
      readOnly: true
      x-speakeasy-unknown-values: allow
    InvalidParameters:
      description: invalid parameters
      type: array
      items:
        oneOf:
        - $ref: '#/components/schemas/InvalidParameterStandard'
        - $ref: '#/components/schemas/InvalidParameterMinimumLength'
        - $ref: '#/components/schemas/InvalidParameterMaximumLength'
        - $ref: '#/components/schemas/InvalidParameterChoiceItem'
        - $ref: '#/components/schemas/InvalidParameterDependentItem'
      minItems: 1
      nullable: false
      uniqueItems: true
    BadRequestError:
      allOf:
      - $ref: '#/components/schemas/BaseError'
      - type: object
        required:
        - invalid_parameters
        properties:
          invalid_parameters:
            $ref: '#/components/schemas/InvalidParameters'
    SnippetTitle:
      description: The display title of a snippet in a portal.
      type: string
      example: My Snippet
      maxLength: 512
      title: SnippetTitle
    InvalidParameterStandard:
      type: object
      properties:
        field:
          type: string
          example: name
          readOnly: true
        rule:
          $ref: '#/components/schemas/InvalidRules'
        source:
          type: string
          example: body
        reason:
          type: string
          example: is a required field
          readOnly: true
      additionalProperties: false
      required:
      - field
      - reason
    SnippetContent:
      description: The renderable markdown content of a page in a portal.
      type: string
      example: '# Welcome to My Snippet'
      maxLength: 1000000
      title: SnippetContent
    DateTimeFieldFilter:
      description: Filters on the given datetime (RFC-3339) field value.
      oneOf:
      - type: object
        title: DateTimeFieldEqualsFilter
        additionalProperties: false
        properties:
          eq:
            description: Value strictly equals given RFC-3339 formatted timestamp in UTC
            type: string
            format: date-time
            example: '2022-03-30T07:20:50Z'
        required:
        - eq
      - type: object
        title: DateTimeFieldLTFilter
        additionalProperties: false
        properties:
          lt:
            description: Value is less than the given RFC-3339 formatted timestamp in UTC
            type: string
            format: date-time
            example: '2022-03-30T07:20:50Z'
        required:
        - lt
      - type: object
        title: DateTimeFieldLTEFilter
        additionalProperties: false
        properties:
          lte:
            description: Value is less than or equal to the given RFC-3339 formatted timestamp in UTC
            type: string
            format: date-time
            example: '2022-03-30T07:20:50Z'
        required:
        - lte
      - type: object
        title: DateTimeFieldGTFilter
        additionalProperties: false
        properties:
          gt:
            description: Value is greater than the given RFC-3339 formatted timestamp in UTC
            type: string
            format: date-time
            example: '2022-03-30T07:20:50Z'
        required:
        - gt
      - type: object
        title: DateTimeFieldGTEFilter
        additionalProperties: false
        properties:
          gte:
            description: Value is greater than or equal to the given RFC-3339 formatted timestamp in UTC
            type: string
            format: date-time
            example: '2022-03-30T07:20:50Z'
        required:
        - gte
      title: DateTimeFieldFilter
    CreatePortalSnippetRequest:
      description: Create a snippet in a portal.
      type: object
      properties:
        name:
          $ref: '#/components/schemas/SnippetName'
        title:
          $ref: '#/components/schemas/SnippetTitle'
        content:
          $ref: '#/components/schemas/SnippetContent'
        visibility:
          $ref: '#/components/schemas/SnippetVisibilityStatus'
        status:
          $ref: '#/components/schemas/PublishedStatus'
        description:
          $ref: '#/components/schemas/Description'
      additionalProperties: false
      required:
      - name
      - content
      title: CreatePortalSnippetRequest
    UpdatePortalSnippetRequest:
      description: Update a snippet in a portal.
      type: object
      properties:
        name:
          $ref: '#/components/schemas/SnippetName'
        title:
          $ref: '#/components/schemas/SnippetTitle'
        content:
          $ref: '#/components/schemas/SnippetContent'
        visibility:
          $ref: '#/components/schemas/VisibilityStatus'
        status:
          $ref: '#/components/schemas/PublishedStatus'
        description:
          $ref: '#/components/schemas/Description'
      additionalProperties: false
      title: UpdatePortalSnippetRequest
    VisibilityStatus:
      description: Whether the resource is publicly accessible to non-authenticated users.
      type: string
      example: public
      enum:
      - public
      - private
      title: VisibilityStatus
      x-speakeasy-unknown-values: allow
    PortalSnippetInfo:
      description: Information about a snippet in a portal.
      type: object
      properties:
        id:
          $ref: '#/components/schemas/UUID'
        name:
          $ref: '#/components/schemas/SnippetName'
        title:
          $ref: '#/components/schemas/SnippetTitle'
        visibility:
          $ref: '#/components/schemas/VisibilityStatus'
        status:
          $ref: '#/components/schemas/PublishedStatus'
        description:
          $ref: '#/components/schemas/Description'
        created_at:
          $ref: '#/components/schemas/CreatedAt'
        updated_at:
          $ref: '#/components/schemas/UpdatedAt'
      additionalProperties: false
      required:
      - id
      - name
      - title
      - visibility
      - status
      - created_at
      - updated_at
      title: PortalSnippetInfo
    NotFoundError:
      allOf:
      - $ref: '#/components/schemas/BaseError'
      - type: object
        properties:
          status:
            example: 404
          title:
            example: Not Found
          type:
            example: https://httpstatuses.com/404
          instance:
            example: kong:trace:1234567890
          detail:
            example: Not found
    PageMeta:
      description: Contains pagination query parameters and the total number of objects returned.
      type: object
      properties:
        number:
          type: number
          example: 1
          x-speakeasy-terraform-ignore: true
        size:
          type: number
          example: 10
          x-speakeasy-terraform-ignore: true
        total:
          type: number
          example: 100
          x-speakeasy-terraform-ignore: true
      required:
      - number
      - size
      - total
    PortalSnippetResponse:
      description: Details about a snippet in a portal.
      type: object
      properties:
        id:
          $ref: '#/components/schemas/UUID'
        name:
          $ref: '#/components/schemas/SnippetName'
        title:
          $ref: '#/components/schemas/SnippetTitle'
        content:
          $ref: '#/components/schemas/SnippetContent'
        visibility:
          $ref: '#/components/schemas/VisibilityStatus'
        status:
          $ref: '#/components/schemas/PublishedStatus'
        description:
          $ref: '#/components/schemas/Description'
        created_at:
          $ref: '#/components/schemas/CreatedAt'
        updated_at:
          $ref: '#/components/schemas/UpdatedAt'
      additionalProperties: false
      required:
      - id
      - name
      - content
      - visibility
      - status
      - created_at
      - updated_at
      title: PortalSnippetResponse
  requestBodies:
    UpdatePortalSnippet:
      description: Update a snippet in a portal.
      required: true
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/UpdatePortalSnippetRequest'
    CreatePortalSnippet:
      description: Create a snippet in a portal.
      required: true
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/CreatePortalSnippetRequest'
  responses:
    NotFound:
      description: Not Found
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/NotFoundError'
    Unauthorized:
      description: Unauthorized
      content:
        application/problem+json:
          schema:
            description: The error response object.
            type: object
            properties:
              status:
                description: The HTTP status code.
                type: integer
                example: 403
              title:
                description: The Error Response.
                type: string
                example: Unauthorized
              instance:
                description: The Konnect traceback code.
                type: string
                example: konnect:trace:952172606039454040
              detail:
                description: Details about the error response.
                type: string
                example: You do not have permission to perform this action
            $ref: '#/components/schemas/UnauthorizedError'
            title: Unauthorized Response
    PortalSnippet:
      description: Details about a snippet in a portal.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/PortalSnippetResponse'
    ListPortalSnippets:
      description: A paginated list of custom snippets in a portal.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ListPortalSnippetsResponse'
    Forbidden:
      description: Forbidden
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/ForbiddenError'
  parameters:
    SnippetId:
      schema:
        type: string
        format: uuid
        example: ebbac5b0-ac89-45c3-9d2e-c4542c657e79
      name: snippetId
      in: path
      required: true
      description: ID of the snippet.
      x-speakeasy-match: id
    PageSize:
      name: page[size]
      description: The maximum number of items to include per page. The last page of a collection may include fewer items.
      required: false
      in: query
      allowEmptyValue: true
      schema:
        type: integer
        example: 10
      x-speakeasy-terraform-ignore: true
    PageNumber:
      name: page[number]
      description: Determines which page of the entities to retrieve.
      required: false
      in: query
      allowEmptyValue: true
      schema:
        type: integer
        example: 1
      x-speakeasy-terraform-ignore: true
    PortalId:
      schema:
        type: string
        format: uuid
        example: f32d905a-ed33-46a3-a093-d8f536af9a8a
      name: portalId
      in: path
      required: true
      description: ID of the portal.
    SortPortalSnippets:
      name: sort
      description: "Sorts a collection of portal snippets. Supported sort attributes are:\n  - created_at\n  - updated_at\n  - name\n  - title\n  - visibility\n"
      in: query
      required: false
      schema:
        type: string
  securitySchemes:
    adminToken:
      in: header
      name: Kong-Admin-Token
      type: apiKey
externalDocs:
  description: Documentation for Kong Gateway and its APIs
  url: https://developer.konghq.com