Skip to content

Latest commit

 

History

History
439 lines (296 loc) · 13 KB

TemplatesApi.md

File metadata and controls

439 lines (296 loc) · 13 KB

PDFGeneratorAPI\TemplatesApi

All URIs are relative to https://us1.pdfgeneratorapi.com/api/v3.

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

copyTemplate()

copyTemplate($template_id, $name): \PDFGeneratorAPI\Model\InlineResponse2001

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
$name = My copied template; // string | Name for the copied template. If name is not specified then the original name is used.

try {
    $result = $apiInstance->copyTemplate($template_id, $name);
    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
name string Name for the copied template. If name is not specified then the original name is used. [optional]

Return type

\PDFGeneratorAPI\Model\InlineResponse2001

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]

createTemplate()

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

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 as JSON string

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 as JSON string

Return type

\PDFGeneratorAPI\Model\InlineResponse2001

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): \PDFGeneratorAPI\Model\InlineResponse2002

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 {
    $result = $apiInstance->deleteTemplate($template_id);
    print_r($result);
} 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

\PDFGeneratorAPI\Model\InlineResponse2002

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]

getEditorUrl()

getEditorUrl($template_id, $body, $language): \PDFGeneratorAPI\Model\InlineResponse2003

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.

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
$body = new \stdClass; // object | Data used to generate the PDF. This can be JSON encoded string or a public URL to your JSON file.
$language = en; // string | Specify the editor UI language. Defaults to organization editor language.

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

Parameters

Name Type Description Notes
template_id int Template unique identifier
body object Data used to generate the PDF. This can be JSON encoded string or a public URL to your JSON file.
language string Specify the editor UI language. Defaults to organization editor language. [optional]

Return type

\PDFGeneratorAPI\Model\InlineResponse2003

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]

getTemplate()

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

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\InlineResponse2001

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(): \PDFGeneratorAPI\Model\InlineResponse200

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
);

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

Parameters

This endpoint does not need any parameter.

Return type

\PDFGeneratorAPI\Model\InlineResponse200

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]

updateTemplate()

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

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 as JSON string

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 as JSON string

Return type

\PDFGeneratorAPI\Model\InlineResponse2001

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]