Baserow Database table view sortings API

The Database table view sortings API from Baserow — 3 operation(s) for database table view sortings.

OpenAPI Specification

baserow-database-table-view-sortings-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Baserow API spec Admin Database table view sortings API
  version: 2.2.2
  description: 'For more information about our REST API, please visit [this page](https://baserow.io/docs/apis%2Frest-api).


    For more information about our deprecation policy, please visit [this page](https://baserow.io/docs/apis%2Fdeprecations).'
  contact:
    url: https://baserow.io/contact
  license:
    name: MIT
    url: https://github.com/baserow/baserow/blob/develop/LICENSE
tags:
- name: Database table view sortings
paths:
  /api/database/views/{view_id}/sortings/:
    get:
      operationId: list_database_table_view_sortings
      description: Lists all sortings of the view related to the provided `view_id` if the user has access to the related database's workspace. A view can have multiple sortings. When all the rows are requested they will be in the desired order.
      parameters:
      - in: path
        name: view_id
        schema:
          type: integer
        description: Returns only sortings of the view related to the provided value.
        required: true
      tags:
      - Database table view sortings
      security:
      - UserSource JWT: []
      - JWT: []
      responses:
        '200':
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ViewSort'
          description: ''
        '400':
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Machine readable error indicating what went wrong.
                    enum:
                    - ERROR_USER_NOT_IN_GROUP
                  detail:
                    oneOf:
                    - type: string
                      format: string
                      description: Human readable details about what went wrong.
                    - type: object
                      format: object
                      description: Machine readable object about what went wrong.
          description: ''
        '404':
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Machine readable error indicating what went wrong.
                    enum:
                    - ERROR_VIEW_DOES_NOT_EXIST
                  detail:
                    oneOf:
                    - type: string
                      format: string
                      description: Human readable details about what went wrong.
                    - type: object
                      format: object
                      description: Machine readable object about what went wrong.
          description: ''
    post:
      operationId: create_database_table_view_sort
      description: Creates a new sort for the view related to the provided `view_id` parameter if the authorized user has access to the related database's workspace. When the rows of a view are requested, for example via the `list_database_table_grid_view_rows` endpoint, they will be returned in the respected order defined by all the sortings.
      parameters:
      - in: header
        name: ClientSessionId
        schema:
          type: string
          format: uuid
        description: An optional header that marks the action performed by this request as having occurred in a particular client session. Then using the undo/redo endpoints with the same ClientSessionId header this action can be undone/redone.
      - in: header
        name: ClientUndoRedoActionGroupId
        schema:
          type: string
          format: uuid
        description: An optional header that marks the action performed by this request as having occurred in a particular action group.Then calling the undo/redo endpoint with the same ClientSessionId header, all the actions belonging to the same action group can be undone/redone together in a single API call.
      - in: path
        name: view_id
        schema:
          type: integer
        description: Creates a sort for the view related to the provided value.
        required: true
      tags:
      - Database table view sortings
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateViewSort'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/CreateViewSort'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/CreateViewSort'
        required: true
      security:
      - UserSource JWT: []
      - JWT: []
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ViewSort'
          description: ''
        '400':
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Machine readable error indicating what went wrong.
                    enum:
                    - ERROR_USER_NOT_IN_GROUP
                    - ERROR_REQUEST_BODY_VALIDATION
                    - ERROR_VIEW_SORT_NOT_SUPPORTED
                    - ERROR_FIELD_NOT_IN_TABLE
                    - ERROR_VIEW_SORT_FIELD_ALREADY_EXISTS
                    - ERROR_VIEW_SORT_FIELD_NOT_SUPPORTED
                  detail:
                    oneOf:
                    - type: string
                      format: string
                      description: Human readable details about what went wrong.
                    - type: object
                      format: object
                      description: Machine readable object about what went wrong.
          description: ''
        '404':
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Machine readable error indicating what went wrong.
                    enum:
                    - ERROR_VIEW_DOES_NOT_EXIST
                  detail:
                    oneOf:
                    - type: string
                      format: string
                      description: Human readable details about what went wrong.
                    - type: object
                      format: object
                      description: Machine readable object about what went wrong.
          description: ''
  /api/database/views/{view_id}/sortings/prioritize/:
    post:
      operationId: prioritize_database_table_view_sortings
      description: Updates the priority of the sorts to match the order of the given IDs. Sorts earlier in the list are applied first.
      parameters:
      - in: header
        name: ClientSessionId
        schema:
          type: string
          format: uuid
        description: An optional header that marks the action performed by this request as having occurred in a particular client session. Then using the undo/redo endpoints with the same ClientSessionId header this action can be undone/redone.
      - in: header
        name: ClientUndoRedoActionGroupId
        schema:
          type: string
          format: uuid
        description: An optional header that marks the action performed by this request as having occurred in a particular action group.Then calling the undo/redo endpoint with the same ClientSessionId header, all the actions belonging to the same action group can be undone/redone together in a single API call.
      - in: path
        name: view_id
        schema:
          type: integer
        description: Updates the priority of the sortings in the view related to the provided value.
        required: true
      tags:
      - Database table view sortings
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PrioritizeViewSortings'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/PrioritizeViewSortings'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/PrioritizeViewSortings'
        required: true
      security:
      - UserSource JWT: []
      - JWT: []
      responses:
        '204':
          description: No response body
        '400':
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Machine readable error indicating what went wrong.
                    enum:
                    - ERROR_USER_NOT_IN_GROUP
                    - ERROR_VIEW_SORT_NOT_IN_VIEW
                  detail:
                    oneOf:
                    - type: string
                      format: string
                      description: Human readable details about what went wrong.
                    - type: object
                      format: object
                      description: Machine readable object about what went wrong.
          description: ''
        '404':
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Machine readable error indicating what went wrong.
                    enum:
                    - ERROR_VIEW_DOES_NOT_EXIST
                  detail:
                    oneOf:
                    - type: string
                      format: string
                      description: Human readable details about what went wrong.
                    - type: object
                      format: object
                      description: Machine readable object about what went wrong.
          description: ''
  /api/database/views/sort/{view_sort_id}/:
    get:
      operationId: get_database_table_view_sort
      description: Returns the existing view sort if the authorized user has access to the related database's workspace.
      parameters:
      - in: path
        name: view_sort_id
        schema:
          type: integer
        description: Returns the view sort related to the provided value.
        required: true
      tags:
      - Database table view sortings
      security:
      - UserSource JWT: []
      - JWT: []
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ViewSort'
          description: ''
        '400':
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Machine readable error indicating what went wrong.
                    enum:
                    - ERROR_USER_NOT_IN_GROUP
                  detail:
                    oneOf:
                    - type: string
                      format: string
                      description: Human readable details about what went wrong.
                    - type: object
                      format: object
                      description: Machine readable object about what went wrong.
          description: ''
        '404':
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Machine readable error indicating what went wrong.
                    enum:
                    - ERROR_VIEW_SORT_DOES_NOT_EXIST
                  detail:
                    oneOf:
                    - type: string
                      format: string
                      description: Human readable details about what went wrong.
                    - type: object
                      format: object
                      description: Machine readable object about what went wrong.
          description: ''
    patch:
      operationId: update_database_table_view_sort
      description: Updates the existing sort if the authorized user has access to the related database's workspace.
      parameters:
      - in: header
        name: ClientSessionId
        schema:
          type: string
          format: uuid
        description: An optional header that marks the action performed by this request as having occurred in a particular client session. Then using the undo/redo endpoints with the same ClientSessionId header this action can be undone/redone.
      - in: header
        name: ClientUndoRedoActionGroupId
        schema:
          type: string
          format: uuid
        description: An optional header that marks the action performed by this request as having occurred in a particular action group.Then calling the undo/redo endpoint with the same ClientSessionId header, all the actions belonging to the same action group can be undone/redone together in a single API call.
      - in: path
        name: view_sort_id
        schema:
          type: integer
        description: Updates the view sort related to the provided value.
        required: true
      tags:
      - Database table view sortings
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PatchedUpdateViewSort'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/PatchedUpdateViewSort'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/PatchedUpdateViewSort'
      security:
      - UserSource JWT: []
      - JWT: []
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ViewSort'
          description: ''
        '400':
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Machine readable error indicating what went wrong.
                    enum:
                    - ERROR_USER_NOT_IN_GROUP
                    - ERROR_FIELD_NOT_IN_TABLE
                    - ERROR_VIEW_SORT_FIELD_ALREADY_EXISTS
                  detail:
                    oneOf:
                    - type: string
                      format: string
                      description: Human readable details about what went wrong.
                    - type: object
                      format: object
                      description: Machine readable object about what went wrong.
          description: ''
        '404':
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Machine readable error indicating what went wrong.
                    enum:
                    - ERROR_VIEW_SORT_DOES_NOT_EXIST
                  detail:
                    oneOf:
                    - type: string
                      format: string
                      description: Human readable details about what went wrong.
                    - type: object
                      format: object
                      description: Machine readable object about what went wrong.
          description: ''
    delete:
      operationId: delete_database_table_view_sort
      description: Deletes the existing sort if the authorized user has access to the related database's workspace.
      parameters:
      - in: header
        name: ClientSessionId
        schema:
          type: string
          format: uuid
        description: An optional header that marks the action performed by this request as having occurred in a particular client session. Then using the undo/redo endpoints with the same ClientSessionId header this action can be undone/redone.
      - in: header
        name: ClientUndoRedoActionGroupId
        schema:
          type: string
          format: uuid
        description: An optional header that marks the action performed by this request as having occurred in a particular action group.Then calling the undo/redo endpoint with the same ClientSessionId header, all the actions belonging to the same action group can be undone/redone together in a single API call.
      - in: path
        name: view_sort_id
        schema:
          type: integer
        description: Deletes the sort related to the provided value.
        required: true
      tags:
      - Database table view sortings
      security:
      - UserSource JWT: []
      - JWT: []
      responses:
        '204':
          description: No response body
        '400':
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Machine readable error indicating what went wrong.
                    enum:
                    - ERROR_USER_NOT_IN_GROUP
                  detail:
                    oneOf:
                    - type: string
                      format: string
                      description: Human readable details about what went wrong.
                    - type: object
                      format: object
                      description: Machine readable object about what went wrong.
          description: ''
        '404':
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Machine readable error indicating what went wrong.
                    enum:
                    - ERROR_VIEW_SORT_DOES_NOT_EXIST
                  detail:
                    oneOf:
                    - type: string
                      format: string
                      description: Human readable details about what went wrong.
                    - type: object
                      format: object
                      description: Machine readable object about what went wrong.
          description: ''
components:
  schemas:
    CreateViewSort:
      type: object
      properties:
        field:
          type: integer
          description: The field that must be sorted on.
        order:
          allOf:
          - $ref: '#/components/schemas/OrderEnum'
          default: ASC
          description: 'Indicates the sort order direction. ASC (Ascending) is from A to Z and DESC (Descending) is from Z to A.


            * `ASC` - Ascending

            * `DESC` - Descending'
        type:
          type: string
          description: Indicates the sort type. Will automatically fall back to `default` if incompatible with field type.
          maxLength: 32
      required:
      - field
    ViewSort:
      type: object
      properties:
        id:
          type: integer
          readOnly: true
        view:
          type: integer
          description: The view to which the sort applies. Each view can have his own sortings.
        field:
          type: integer
          description: The field that must be sorted on.
        order:
          allOf:
          - $ref: '#/components/schemas/OrderEnum'
          description: 'Indicates the sort order direction. ASC (Ascending) is from A to Z and DESC (Descending) is from Z to A.


            * `ASC` - Ascending

            * `DESC` - Descending'
        type:
          type: string
          description: Indicates the sort type. Will automatically fall back to `default` if incompatible with field type.
          maxLength: 32
        priority:
          type: integer
          readOnly: true
          description: Position of this sorting in the ordering chain. The sorting with the lowest priority is applied first.
      required:
      - field
      - id
      - priority
      - view
    PrioritizeViewSortings:
      type: object
      properties:
        view_sort_ids:
          type: array
          items:
            type: integer
          description: View sort ids in the desired priority order. The sort with the lowest position in the list is applied first.
          minItems: 1
      required:
      - view_sort_ids
    PatchedUpdateViewSort:
      type: object
      properties:
        field:
          type: integer
          description: The field that must be sorted on.
        order:
          allOf:
          - $ref: '#/components/schemas/OrderEnum'
          description: 'Indicates the sort order direction. ASC (Ascending) is from A to Z and DESC (Descending) is from Z to A.


            * `ASC` - Ascending

            * `DESC` - Descending'
        type:
          type: string
          description: Indicates the sort type. Will automatically fall back to `default` if incompatible with field type.
          maxLength: 32
    OrderEnum:
      enum:
      - ASC
      - DESC
      type: string
      description: '* `ASC` - Ascending

        * `DESC` - Descending'
  securitySchemes:
    Database token:
      type: http
      scheme: bearer
      bearerFormat: Token your_token
    JWT:
      type: http
      scheme: bearer
      bearerFormat: JWT your_token
    UserSource JWT:
      type: http
      scheme: bearer
      bearerFormat: JWT your_token