PDF templates

List PDF templates

GET /fast-events/v1/admin/pdf-templates

Retrieve all PDF templates. Users with the administrator role will see all templates. Other users will only see the templates they own.

Optional query parameters

_fields

A comma separated string of fields included in the response. For example id,title.

Example request

$ curl \
  -H "X-FE-API-KEY: 3zo58AUYP9zOE6YT"  \
  -H "Content-Type: application/json" \
  -u "test:4ZAN O5OY OAvZ FZb2 Lslv JnJG" \
  https://exampledomain.com/wp-json/fast-events/v1/admin/pdf-templates

Example response

[
    {
        "id": 30,
        "title": "Eticket template OpenAir",
        "type": "ticket",
        "author_id": 1,
        "created": "2023-05-01 17:05:15",
        "modified": "2023-05-01 17:05:15",
        "url": "https://exampledomain.com/wp-content/uploads/2023/05/OpenAir-Eticket.pdf",
        "username": "d4k12lqw",
        "_links": {
            "self": [
                {
                    "href": "https://exampledomain.com/wp-json/fast-events/v1/admin/pdf-templates/30"
                }
            ],
            "collection": [
                {
                    "href": "https://exampledomain.com/wp-json/fast-events/v1/admin/pdf-templates"
                }
            ]
        }
    },
    {
        "id": 31,
        "title": "Eticket template Forest to Forest",
        "type": "ticket",
        "author_id": 1,
        "created": "2023-05-01 17:05:15",
        "modified": "2023-05-01 17:05:15",
        "url": "https://exampledomain.com/wp-content/uploads/2023/05/F2ftour.pdf",
        "username": "d4k12lqw",
        "_links": {
            "self": [
                {
                    "href": "https://exampledomain.com/wp-json/fast-events/v1/admin/pdf-templates/31"
                }
            ],
            "collection": [
                {
                    "href": "https://exampledomain.com/wp-json/fast-events/v1/admin/pdf-templates"
                }
            ]
        }
    }
]

The HTTP headers of the response contains additional information about the collection.

X-WP-Total

This header contains the total number of rows in the collection.

X-WP-TotalPages

This header contains the total number of pages. This is always 1.

Changelog

Version

Description

2.0

Introduced.


Get a single PDF template

GET /fast-events/v1/admin/pdf-templates/(integer: id)

Retrieve details of a single PDF template.

Example request

$ curl \
  -H "X-FE-API-KEY: 3zo58AUYP9zOE6YT"  \
  -H "Content-Type: application/json" \
  -u "test:4ZAN O5OY OAvZ FZb2 Lslv JnJG" \
  https://exampledomain.com/wp-json/fast-events/v1/admin/pdf-templates/31

Example response

{
    "id": 31,
    "title": "Eticket template Forest to Forest",
    "type": "ticket",
    "author_id": 1,
    "created": "2023-05-01 17:05:15",
    "modified": "2023-05-01 17:05:15",
    "url": "https://exampledomain.com/wp-content/uploads/2023/05/F2ftour.pdf",
    "username": "d4k12lqw",
    "_links": {
        "self": [
            {
                "href": "https://exampledomain.com/wp-json/fast-events/v1/admin/pdf-templates/31"
            }
        ],
        "collection": [
            {
                "href": "https://exampledomain.com/wp-json/fast-events/v1/admin/pdf-templates"
            }
        ]
    }
}

Changelog

Version

Description

2.0

Introduced.


Update PDF template

PUT /fast-events/v1/admin/pdf-templates/(integer: id)

Update a single PDF template. Only the fields title and type can be changed. If the API user has the administrator role, you can also change the author_id. Effectively changing the owner of the PDF template. Optionally, you can also replace the PDF template with a new one.

Example request

$ curl \
  -X PUT \
  -H "X-FE-API-KEY: 3zo58AUYP9zOE6YT"  \
  -H "Content-Type: application/json" \
  -u "test:4ZAN O5OY OAvZ FZb2 Lslv JnJG" \
  -d '{"title":"Improved eticket template"}' \
  -F "file=@path/to/local/file/F2ftour.pdf" \
  https://exampledomain.com/wp-json/fast-events/v1/admin/pdf-templates/31

Example response

{
    "id": 31,
    "title": "Improved eticket template",
    "type": "ticket",
    "author_id": 1,
    "created": "2023-05-01 17:05:15",
    "modified": "2023-05-03 10:23:09",
    "url": "https://exampledomain.com/wp-content/uploads/2023/05/F2ftour.pdf",
    "username": "d4k12lqw",
    "_links": {
        "self": [
            {
                "href": "https://exampledomain.com/wp-json/fast-events/v1/admin/pdf-templates/31"
            }
        ],
        "collection": [
            {
                "href": "https://exampledomain.com/wp-json/fast-events/v1/admin/pdf-templates"
            }
        ]
    }
}

Changelog

Version

Description

2.0

Introduced.


Delete a PDF template

DELETE /fast-events/v1/admin/pdf-templates/(integer: id)

Delete a single PDF template.

Example request

$ curl \
  -X DELETE \
  -H "X-FE-API-KEY: 3zo58AUYP9zOE6YT"  \
  -H "Content-Type: application/json" \
  -u "test:4ZAN O5OY OAvZ FZb2 Lslv JnJG" \
  https://exampledomain.com/wp-json/fast-events/v1/admin/pdf-templates/31

Example response

{
    "deleted": true,
    "previous": {
        "id": 31,
        "title": "Improved eticket template",
        "type": "ticket",
        "author_id": 1,
        "created": "2023-05-01 17:05:15",
        "modified": "2023-05-03 10:23:09",
        "url": "https://exampledomain.com/wp-content/uploads/2023/05/F2ftour.pdf",
        "username": "d4k12lqw",
    }
}

Changelog

Version

Description

2.0

Introduced.


Upload a new PDF template

POST /fast-events/v1/admin/pdf-templates

Create/upload a new PDF template.

How to create a template?

Use for example Word, LibreOffice, … and design a single-page A4 e-ticket. Leave a 120 mm x 40 mm block somewhere on the page. You can position it either vertical or horizontal or even in any angle you want. This is the block where Fast Events will print the qrcode block and some other information. It is possible to scale down the qrcode block.

Recommendations

Keep the PDF as small as possible, preferable below 200kb for a single eticket. Don’t use full blown images. Bring them back to an acceptable resolution. And pull them first through sites like https://kraken.io to squeeze the size. An image resolution of 150 DPI for etickets is enough. Make use of use the pdf system fonts. For example use for your text the Helvetica font. Try to prevent the use of special fonts, because these are embedded in the PDF and then the PDF becomes larger. You can analyse your PDF here.

Example request

$ curl \
  -X PUT \
  -H "X-FE-API-KEY: 3zo58AUYP9zOE6YT"  \
  -H "Content-Type: application/json" \
  -u "test:4ZAN O5OY OAvZ FZb2 Lslv JnJG" \
  -d '{"title":"Eticket template Forest to Forest"}' \
  -F "file=@path/to/local/file/F2ftour.pdf" \
  https://exampledomain.com/wp-json/fast-events/v1/admin/pdf-templates

Example response

{
    "id": 31,
    "title": "Eticket template Forest to Forest",
    "type": "ticket",
    "author_id": 1,
    "created": "2023-05-01 17:05:15",
    "modified": "2023-05-01 17:05:15",
    "url": "https://exampledomain.com/wp-content/uploads/2023/05/F2ftour.pdf",
    "username": "d4k12lqw",
    "_links": {
        "self": [
            {
                "href": "https://exampledomain.com/wp-json/fast-events/v1/admin/pdf-templates/31"
            }
        ],
        "collection": [
            {
                "href": "https://exampledomain.com/wp-json/fast-events/v1/admin/pdf-templates"
            }
        ]
    }
}

Changelog

Version

Description

2.0

Introduced.