SDKs overview

PrexView offers a suite of Software Development Kits (SDKs) and client libraries designed to facilitate interaction with its document generation API. These SDKs abstract the underlying HTTP requests and JSON parsing, allowing developers to integrate PrexView's capabilities into applications written in various programming languages. The official SDKs support common tasks such as creating documents from templates, managing templates, and handling document outputs. The API itself is RESTful, communicating over standard HTTP methods and JSON payloads, a common pattern for web service APIs Google Places API overview.

The primary advantage of using an SDK over direct API calls is the reduction in boilerplate code and handling of common concerns like authentication, request formatting, and error handling. PrexView's SDKs are maintained by the PrexView team and are intended to provide idiomatic interfaces for each supported language, aligning with each language's conventions where possible.

Developers who prefer not to use an SDK can interact directly with the PrexView REST API Reference, constructing HTTP requests manually. However, official SDKs are recommended for most use cases due to simplified integration and ongoing support.

Official SDKs by language

PrexView provides official SDKs for five popular programming languages. These libraries are developed and maintained by PrexView to ensure compatibility and leverage the latest API features. Each SDK aims to provide a native development experience for its respective language, handling aspects such as authentication, request serialization, and response deserialization.

Language Package Name / Identifier Installation Command (Example) Maturity / Status
Python prexview-python-sdk pip install prexview-python-sdk Stable, Actively Maintained
Node.js @prexview/node-sdk npm install @prexview/node-sdk Stable, Actively Maintained
PHP prexview/php-sdk composer require prexview/php-sdk Stable, Actively Maintained
Java com.prexview:java-sdk (Maven/Gradle dependency) Stable, Actively Maintained
Ruby prexview-ruby-sdk gem install prexview-ruby-sdk Stable, Actively Maintained

For detailed documentation and specific version information for each SDK, refer to the PrexView developer documentation.

Installation

Installation procedures for PrexView SDKs vary by programming language and package manager. The following provides general instructions for each officially supported language. Prior to installation, ensure that the appropriate language runtime and package manager are installed on your system.

Python

The Python SDK is distributed via PyPI. Use pip for installation:

pip install prexview-python-sdk

For more details on Python package management, consult the Python Packaging User Guide.

Node.js

The Node.js SDK is available on npm. Install it using the npm command:

npm install @prexview/node-sdk

Alternatively, if using Yarn:

yarn add @prexview/node-sdk

PHP

The PHP SDK uses Composer for dependency management. Add it to your project's composer.json or install directly:

composer require prexview/php-sdk

Ensure Composer is installed and globally accessible. For further information, see the Composer documentation.

Java

The Java SDK typically integrates using Maven or Gradle. Add the following dependency to your pom.xml (Maven) or build.gradle (Gradle) file:

Maven (pom.xml):

<dependency>
    <groupId>com.prexview</groupId>
    <artifactId>java-sdk</artifactId>
    <version>1.0.0</version> <!-- Replace with the latest version -->
</dependency>

Gradle (build.gradle):

implementation 'com.prexview:java-sdk:1.0.0' // Replace with the latest version

Retrieve the latest version from the PrexView Java SDK installation guide.

Ruby

The Ruby SDK is available as a RubyGem. Install it using the gem command:

gem install prexview-ruby-sdk

For projects using Bundler, add it to your Gemfile:

gem 'prexview-ruby-sdk'

Then run bundle install.

Quickstart example

This section provides a quickstart example using the Node.js SDK to generate a simple document. The example demonstrates authenticating with an API key, defining template data, and initiating document generation. For other languages and more complex scenarios, refer to the PrexView quickstart guides.

Before running this example, ensure you have installed the Node.js SDK and have a valid PrexView API key.

Node.js Quickstart: Generate a Document


const { PrexView } = require('@prexview/node-sdk');

// Initialize PrexView client with your API key
const prexview = new PrexView('YOUR_PREXVIEW_API_KEY');

async function generateDocument() {
  try {
    const templateId = 'your_template_id'; // Replace with your template ID
    const data = {
      title: 'Monthly Sales Report',
      date: '2026-05-29',
      items: [
        { product: 'Product A', quantity: 10, price: 50 },
        { product: 'Product B', quantity: 5, price: 120 }
      ],
      total: 1100
    };

    // Generate the document
    const document = await prexview.documents.generate(templateId, data, {
      output: 'pdf' // Specify output format, e.g., 'pdf', 'html'
    });

    console.log('Document ID:', document.id);
    console.log('Document URL:', document.url); // URL to download the generated document
    console.log('Document generation successful!');

  } catch (error) {
    console.error('Error generating document:', error.message);
    if (error.response) {
      console.error('API Error Response:', error.response.data);
    }
  }
}

generateDocument();

In this example:

  1. The PrexView client is initialized with your API key.
  2. A templateId identifies the PrexView template to be used. Templates are designed within the PrexView template designer.
  3. A data object provides the dynamic content that will populate the template placeholders.
  4. The prexview.documents.generate method is called, specifying the template, data, and desired output format (e.g., PDF).
  5. The response includes a document.id and a document.url for retrieving the generated file.

Remember to replace 'YOUR_PREXVIEW_API_KEY' and 'your_template_id' with your actual credentials and template identifier. API keys should be handled securely, typically through environment variables rather than hardcoding them directly in source code AWS security best practices for access keys.

Community libraries

While PrexView provides official SDKs for the most commonly used languages, the open nature of its RESTful API allows for the development of community-contributed libraries. These libraries are typically developed and maintained by individual developers or third-party organizations and may offer support for additional languages or specialized functionalities not present in the official SDKs. As of the current date, PrexView maintains its primary focus on the official SDKs listed above. Information on community-contributed libraries can often be found through developer forums, GitHub repositories, or package managers specific to less common languages.

When considering a community library, it is advisable to evaluate its maintenance status, community support, and compatibility with the latest PrexView API versions. While community libraries can expand accessibility, they may not offer the same level of support or guarantee of future compatibility as official offerings. Developers are encouraged to check the PrexView documentation or community channels for any officially recognized or recommended third-party integrations.

The PrexView API documentation provides comprehensive details for direct HTTP integration, which serves as the foundation for both official and community-developed clients. This ensures that even without an official SDK, developers can build custom integrations in any language capable of making HTTP requests and processing JSON.