Skip to content

Latest commit

 

History

History
508 lines (345 loc) · 15.8 KB

TemplatesApi.md

File metadata and controls

508 lines (345 loc) · 15.8 KB

PDFGeneratorAPI\TemplatesApi

All URIs are relative to https://us1.pdfgeneratorapi.com/api/v4, except if the operation defines another base path.

Method HTTP request Description
copyTemplate() POST /templates/{templateId}/copy Copy template
createTemplate() POST /templates Create template
deleteTemplate() DELETE /templates/{templateId} Delete template
getTemplate() GET /templates/{templateId} Get template
getTemplateData() GET /templates/{templateId}/data Get template data fields
getTemplates() GET /templates Get templates
openEditor() POST /templates/{templateId}/editor Open editor
updateTemplate() PUT /templates/{templateId} Update template

copyTemplate()

copyTemplate($template_id, $copy_template_request): \PDFGeneratorAPI\Model\CreateTemplate201Response

Copy template

Creates a copy of a template to the workspace specified in authentication parameters.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer (JWT) authorization: JSONWebTokenAuth
$config = PDFGeneratorAPI\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new PDFGeneratorAPI\Api\TemplatesApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$template_id = 19375; // int | Template unique identifier
$copy_template_request = new \PDFGeneratorAPI\Model\CopyTemplateRequest(); // \PDFGeneratorAPI\Model\CopyTemplateRequest

try {
    $result = $apiInstance->copyTemplate($template_id, $copy_template_request);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling TemplatesApi->copyTemplate: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
template_id int Template unique identifier
copy_template_request \PDFGeneratorAPI\Model\CopyTemplateRequest [optional]

Return type

\PDFGeneratorAPI\Model\CreateTemplate201Response

Authorization

JSONWebTokenAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

createTemplate()

createTemplate($template_definition_new): \PDFGeneratorAPI\Model\CreateTemplate201Response

Create template

Creates a new template. If template configuration is not specified in the request body then an empty template is created. Template is placed to the workspace specified in authentication params. Template configuration must be sent in the request body.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer (JWT) authorization: JSONWebTokenAuth
$config = PDFGeneratorAPI\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new PDFGeneratorAPI\Api\TemplatesApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$template_definition_new = new \PDFGeneratorAPI\Model\TemplateDefinitionNew(); // \PDFGeneratorAPI\Model\TemplateDefinitionNew | Template configuration

try {
    $result = $apiInstance->createTemplate($template_definition_new);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling TemplatesApi->createTemplate: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
template_definition_new \PDFGeneratorAPI\Model\TemplateDefinitionNew Template configuration

Return type

\PDFGeneratorAPI\Model\CreateTemplate201Response

Authorization

JSONWebTokenAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

deleteTemplate()

deleteTemplate($template_id)

Delete template

Deletes the template from workspace

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer (JWT) authorization: JSONWebTokenAuth
$config = PDFGeneratorAPI\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new PDFGeneratorAPI\Api\TemplatesApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$template_id = 19375; // int | Template unique identifier

try {
    $apiInstance->deleteTemplate($template_id);
} catch (Exception $e) {
    echo 'Exception when calling TemplatesApi->deleteTemplate: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
template_id int Template unique identifier

Return type

void (empty response body)

Authorization

JSONWebTokenAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getTemplate()

getTemplate($template_id): \PDFGeneratorAPI\Model\CreateTemplate201Response

Get template

Returns template configuration

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer (JWT) authorization: JSONWebTokenAuth
$config = PDFGeneratorAPI\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new PDFGeneratorAPI\Api\TemplatesApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$template_id = 19375; // int | Template unique identifier

try {
    $result = $apiInstance->getTemplate($template_id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling TemplatesApi->getTemplate: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
template_id int Template unique identifier

Return type

\PDFGeneratorAPI\Model\CreateTemplate201Response

Authorization

JSONWebTokenAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getTemplateData()

getTemplateData($template_id): \PDFGeneratorAPI\Model\GetTemplateData200Response

Get template data fields

Returns all data fields used in the template. Returns structured JSON data that can be used to check which data fields are used in template or autogenerate sample data.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer (JWT) authorization: JSONWebTokenAuth
$config = PDFGeneratorAPI\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new PDFGeneratorAPI\Api\TemplatesApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$template_id = 19375; // int | Template unique identifier

try {
    $result = $apiInstance->getTemplateData($template_id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling TemplatesApi->getTemplateData: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
template_id int Template unique identifier

Return type

\PDFGeneratorAPI\Model\GetTemplateData200Response

Authorization

JSONWebTokenAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getTemplates()

getTemplates($name, $tags, $access, $page, $per_page): \PDFGeneratorAPI\Model\GetTemplates200Response

Get templates

Returns a list of templates available for the authenticated workspace

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer (JWT) authorization: JSONWebTokenAuth
$config = PDFGeneratorAPI\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new PDFGeneratorAPI\Api\TemplatesApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$name = 'name_example'; // string | Filter template by name
$tags = 'tags_example'; // string | Filter template by tags
$access = private; // string | Filter template by access type. No values returns all templates. private - returns only private templates, organization - returns only organization templates.
$page = 1; // int | Pagination: page to return
$per_page = 20; // int | Pagination: How many records to return per page

try {
    $result = $apiInstance->getTemplates($name, $tags, $access, $page, $per_page);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling TemplatesApi->getTemplates: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
name string Filter template by name [optional]
tags string Filter template by tags [optional]
access string Filter template by access type. No values returns all templates. private - returns only private templates, organization - returns only organization templates. [optional] [default to '']
page int Pagination: page to return [optional] [default to 1]
per_page int Pagination: How many records to return per page [optional] [default to 15]

Return type

\PDFGeneratorAPI\Model\GetTemplates200Response

Authorization

JSONWebTokenAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

openEditor()

openEditor($template_id, $open_editor_request): \PDFGeneratorAPI\Model\OpenEditor200Response

Open editor

Returns an unique URL which you can use to redirect your user to the editor from your application or use the generated URL as iframe source to show the editor within your application. When using iframe, make sure that your browser allows third-party cookies.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer (JWT) authorization: JSONWebTokenAuth
$config = PDFGeneratorAPI\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new PDFGeneratorAPI\Api\TemplatesApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$template_id = 19375; // int | Template unique identifier
$open_editor_request = new \PDFGeneratorAPI\Model\OpenEditorRequest(); // \PDFGeneratorAPI\Model\OpenEditorRequest

try {
    $result = $apiInstance->openEditor($template_id, $open_editor_request);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling TemplatesApi->openEditor: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
template_id int Template unique identifier
open_editor_request \PDFGeneratorAPI\Model\OpenEditorRequest

Return type

\PDFGeneratorAPI\Model\OpenEditor200Response

Authorization

JSONWebTokenAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

updateTemplate()

updateTemplate($template_id, $template_definition_new): \PDFGeneratorAPI\Model\CreateTemplate201Response

Update template

Updates template configuration. The template configuration for pages and layout must be complete as the entire configuration is replaced and not merged.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer (JWT) authorization: JSONWebTokenAuth
$config = PDFGeneratorAPI\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new PDFGeneratorAPI\Api\TemplatesApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$template_id = 19375; // int | Template unique identifier
$template_definition_new = new \PDFGeneratorAPI\Model\TemplateDefinitionNew(); // \PDFGeneratorAPI\Model\TemplateDefinitionNew | Template configuration

try {
    $result = $apiInstance->updateTemplate($template_id, $template_definition_new);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling TemplatesApi->updateTemplate: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
template_id int Template unique identifier
template_definition_new \PDFGeneratorAPI\Model\TemplateDefinitionNew Template configuration

Return type

\PDFGeneratorAPI\Model\CreateTemplate201Response

Authorization

JSONWebTokenAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]