Knak AssetFolders API

The AssetFolders API from Knak — 2 operation(s) for assetfolders.

OpenAPI Specification

knak-assetfolders-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  description: '## Overview

    An API specification to provide a Custom Sync Location in Knak.


    By implementing a service conforming to this API specification, you will be able to send asset data to your own service and have that service specify a sync location based on that data.


    ## Authentication

    Knak provides two options for authentication:

    - **Basic Authentication**: Knak will use Basic Authentication to authenticate with your API. You will just need to provide a username and password when configuring the integration.

    - **OAuth2**: Knak will use OAuth2 to authenticate with your API. You will need to implement endpoints under a specified authorization path to support this. The default path will be `/oauth/token` but you can provide a separate path when configuring the integration if you so choose. The flow used is the standard [Authorization Code Grant](https://tools.ietf.org/html/rfc6749#section-4.1).



    Knak will use the tokens generated to make requests from your service.


    ## Custom Sync Location

    When a user has a custom sync location configured and they have set up a sync restriction that leverages the custom sync location.

    Knak will call the `/knak-sync-location` (or your own specified path) endpoint with the asset data when an asset is synced. Your service should return a response with the sync location for the asset.


    When your service provides a sync location, Knak will use that location to display only the available sync location to the user.

    '
  version: V1
  title: Custom Sync Location API Reference Asset Custom Fieldsets AssetFolders API
  x-logo:
    url: https://s3.amazonaws.com/assets.knak.io/img/Knak-Logo-Medium.png
servers:
- url: https://yourService.com/your-sync-location-api
tags:
- name: AssetFolders
paths:
  /asset-folders:
    get:
      description: Retrieve company [asset folders](#tag/asset_folder_model).
      summary: List asset folders
      parameters:
      - in: query
        required: false
        name: filter[brand_id]
        description: ID of brand to filter by. Exact match filter.
        example: 609d7ce223411
        schema:
          type: string
      - in: query
        required: false
        name: filter[parent_folder_id]
        description: ID of parent folder to filter by. Exact match filter.
        example: 609d7ce223411
        schema:
          type: string
      - name: page
        in: query
        required: false
        description: Page number
        example: 1
        schema:
          type: integer
      - name: per_page
        in: query
        required: false
        description: Number of items per page
        example: 10
        schema:
          type: integer
      tags:
      - AssetFolders
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AssetFolderList'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                errors:
                - title: Bad Request.
                  detail: 'Please modify request before attempting again. Message: Requested filter(s) `disallowed_filter` are not allowed. Allowed filter(s) are `brand_id, parent_folder_id`'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                errors:
                - title: Unauthenticated.
                  detail: Authenticate before continuing.
        '403':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                errors:
                - title: Forbidden.
                  detail: This user is not authorized to perform this action. Please adjust permissions before continuing.
    post:
      description: Create an [asset folders](#tag/asset_folder_model).
      summary: Create asset folder
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  example: test
                  maxLength: 191
                type:
                  type: string
                  enum:
                  - folder
                  - campaign
                  example: folder
                parent_folder_id:
                  type: string
                  maxLength: 13
                  example: 609d7ce223411
              required:
              - name
              - type
              - parent_folder_id
      tags:
      - AssetFolders
      responses:
        '201':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AssetFolderItem'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                errors:
                - title: Bad Request.
                  detail: Please modify request before attempting again.`
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                errors:
                - title: Unauthenticated.
                  detail: Authenticate before continuing.
        '403':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                errors:
                - title: Forbidden.
                  detail: This user is not authorized to perform this action. Please adjust permissions before continuing.
  /asset-folders/{asset_folder_id}:
    patch:
      description: Update an [asset folders](#tag/asset_folder_model).
      summary: Update asset folder
      parameters:
      - in: path
        required: true
        name: asset_folder_id
        description: ID of asset folder
        example: 609d7ce223411
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  example: test
                  maxLength: 191
                parent_folder_id:
                  type: string
                  maxLength: 13
                  example: 609d7ce223411
      tags:
      - AssetFolders
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AssetFolderItem'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                errors:
                - title: Bad Request.
                  detail: Please modify request before attempting again.`
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                errors:
                - title: Unauthenticated.
                  detail: Authenticate before continuing.
        '403':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                errors:
                - title: Forbidden.
                  detail: This user is not authorized to perform this action. Please adjust permissions before continuing.
    delete:
      description: Delete an [asset folders](#tag/asset_folder_model) and all its sub-content including folders, campaigns and assets.
      summary: Delete an asset folder
      parameters:
      - in: path
        required: true
        name: asset_folder_id
        description: ID of asset folder
        example: 609d7ce223411
        schema:
          type: string
      tags:
      - AssetFolders
      responses:
        '204':
          description: OK
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                errors:
                - title: Bad Request.
                  detail: Please modify request before attempting again.`
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                errors:
                - title: Unauthenticated.
                  detail: Authenticate before continuing.
        '403':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                errors:
                - title: Forbidden.
                  detail: This user is not authorized to perform this action. Please adjust permissions before continuing.
components:
  schemas:
    AssetFolder:
      type: object
      properties:
        type:
          type: string
          example: asset-folder
        id:
          type: string
          example: 609d7ce223411
        attributes:
          type: object
          properties:
            id:
              type: string
              example: 609d7ce223411
            name:
              type: string
              example: Spring Newsletter
            parent_folder_id:
              type: string
              example: 609d7ce223411
              nullable: true
            brand_id:
              type: string
              example: 609d7ce223411
            type:
              type: string
              example: folder
            created_at:
              type: string
              example: '2018-04-14T18:35:58+00:00'
            updated_at:
              type: string
              example: '2018-04-14T18:35:58+00:00'
    AssetFolderItem:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/AssetFolder'
    Error:
      type: object
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              status:
                type: string
                description: HTTP status code as a string. Returned by endpoints that use the JSON:API error shape.
                example: '409'
              title:
                type: string
              detail:
                type: string
              meta:
                type: object
                description: Additional context for the error. Returned by endpoints that use the JSON:API error shape.
                additionalProperties: true
    AssetFolderList:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/AssetFolder'
        links:
          type: object
          properties:
            first:
              type: string
              example: https://enterprise.knak.io/api/published/v1/asset-folders?page=1
            last:
              type: string
              example: https://enterprise.knak.io/api/published/v1/asset-folders?page=3
            prev:
              type: string
              nullable: true
              example: https://enterprise.knak.io/api/published/v1/asset-folders?page=1
            next:
              type: string
              nullable: true
              example: https://enterprise.knak.io/api/published/v1/asset-folders?page=3
        meta:
          type: object
          properties:
            current_page:
              type: integer
              example: 1
            from:
              type: integer
              example: 1
            last_page:
              type: integer
              example: 3
            links:
              type: array
              items:
                type: object
                properties:
                  url:
                    type: string
                    nullable: true
                    example: https://enterprise.knak.io/api/published/v1/asset-folders?page=2
                  label:
                    type: string
                    example: Next
                  active:
                    type: boolean
                    example: true
            path:
              type: string
              example: https://enterprise.knak.io/api/published/v1/asset-folders?page=2
            per_page:
              type: integer
              example: 10
            to:
              type: integer
              example: 2
            total:
              type: integer
              example: 2