Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Snippets

Snippets in Kinesis API provide a powerful way to store, share, and reuse code fragments, documentation, and other text-based content. They serve as a central repository for commonly used patterns, examples, and templates that can be easily referenced across your projects.

Understanding Snippets

Each snippet in Kinesis API has:

  • Name: A descriptive title for the snippet
  • Description: A brief explanation of the snippet's purpose
  • Content: The actual text content, which supports Markdown formatting
  • Visibility Setting: Public or private access control
  • Optional Expiry Date: A time when the snippet will automatically expire

Snippets support Markdown with additional features like syntax highlighting for code blocks, diagrams via Mermaid.js, and emoji support, making them versatile for various documentation and code sharing needs.

Accessing Snippets Management

To access the Snippets management interface:

  1. Log in to your Kinesis API account
  2. Navigate to /web/snippets in your browser or select "Snippets" from the navigation menu

Snippets Page

Snippets Interface

The Snippets management interface includes:

  • A searchable list of all your snippets
  • Pagination controls for navigating through large snippet collections
  • Actions for creating, viewing, editing, and deleting snippets
  • Tools for copying snippet links for sharing

Creating a Snippet

To create a new snippet:

  1. Click the "Create a New Snippet" button at the top of the Snippets page

  2. Fill in the required information:

    • Name: A title for your snippet
    • Description: A brief explanation of the snippet's purpose
    • Content: The main text of your snippet, with support for Markdown
    • Expiry (optional): A date when the snippet should expire
    • Visibility: Toggle between public and private
  3. Click "Create" to save your snippet

Create Snippet Page

Markdown Support

When creating or editing snippets, you can use Markdown formatting:

  • Basic formatting: Headings, lists, links, bold, italic, etc.
  • Code blocks: Syntax highlighting for various programming languages
  • Diagrams: Create flowcharts and diagrams using Mermaid.js syntax
  • Tables: Organize data in tabular format
  • Emoji: Add emoji using standard Markdown emoji codes

Viewing Snippets

To view a snippet:

  1. Click on a snippet name or use the "View Snippet" button (open link icon) from the list
  2. The snippet content will be displayed with all formatting applied
  3. Additional details like ID, description, visibility, and expiry date are shown

View Snippet Page

Managing Snippets

Filtering Snippets

To find specific snippets:

  1. Use the search box at the top of the snippets list
  2. Type any part of the snippet name, ID, locator, or description
  3. The list will automatically filter to show matching snippets

Editing Snippets

To edit an existing snippet:

  1. Click the edit button (pencil icon) next to the snippet in the list or on the view page
  2. Modify any of the snippet details
  3. Click "Update Snippet" to save your changes

Edit Snippet Page

Deleting Snippets

To remove a snippet:

  1. Click the delete button (trash icon) next to the snippet
  2. Confirm the deletion in the modal that appears
  3. The snippet will be permanently removed

Sharing Snippets

Snippets can be easily shared:

  1. For any snippet, click the "Copy link to Snippet" button (clipboard icon)
  2. The URL will be copied to your clipboard
  3. Share this URL with others

The URL will be in the format:

https://your-api-domain.com/go/[snippet-locator]

Visibility Controls

Snippets have two visibility settings:

  • Private: Only visible to authenticated users of your Kinesis API instance
  • Public: Accessible to anyone with the link, even without authentication

Choose the appropriate visibility based on the sensitivity of the content and your sharing needs.

Snippet Expiration

When creating or editing a snippet, you can set an optional expiry date:

  1. Select a date and time in the Expiry field
  2. After this time, the snippet will no longer be accessible
  3. Expired snippets are automatically removed from the system

This feature is useful for temporary content that shouldn't persist indefinitely.

Best Practices

For effective snippet management:

  1. Descriptive Names: Use clear, searchable names that indicate the snippet's purpose
  2. Complete Descriptions: Add context in the description to help others understand when and how to use the snippet
  3. Proper Formatting: Use Markdown features to make content more readable and organized
  4. Set Appropriate Visibility: Make snippets public only when the content is suitable for wider access
  5. Use Expiration Dates: For temporary information, set an expiry date to keep your snippet library clean
  6. Organize by Purpose: Create separate snippets for different purposes rather than combining unrelated content

Common Use Cases

Snippets are particularly useful for:

Code Reuse

Store frequently used code patterns for easy reference:

  • API call templates
  • Common functions or utilities
  • Configuration examples

Documentation

Create and share documentation fragments:

  • Setup instructions
  • Troubleshooting guides
  • API usage examples

Knowledge Sharing

Share knowledge across your team:

  • Best practices
  • Architecture decisions
  • Design patterns

Quick Reference

Build a personal reference library:

  • Command line examples
  • Frequent queries
  • Common workflows