SlidePack is a Web API we developed that lets you generate PowerPoint presentations using template PPTX files and JSON data. A typical use case is when you need to create weekly or monthly reports in PowerPoint that are basically the same every time, just with different data inserted.
In January 2022 we began providing a free plan so that anyone can experiment with SlidePack. Here's a quick tutorial to help you take it for a test drive.
What is SlidePack?
In short, it's a templating engine that outputs PPTX files. It's provided as a Web API with free and paid plans.
Upload a zip file containing
- A PPTX file with
{placeholder}
s - JSON data
- Images and videos you want to embed
and you get a rendered PPTX as output.
The free plan lets you render 50 slides per month. Your first month also comes with 500 free slides so you can experiment with different template PPTX designs.
Creating your first template PPTX and JSON
Template syntax is similar to HTML templating engines you may be familiar with. Place {text in curly braces}
in your PPTX like so:
and prepare your data.json like so:
{
"slides": [
{
"template": 1,
"text1": "Text boxes can be placed anywhere in a slide.",
"text2": "Fonts and styles from the template are preserved.",
"text3": "Text box properties like auto-sizing are also preserved.",
"text4": "You can",
"text5": "replace",
"text6": "text in",
"text7": "tables."
}
]
}
to get this output:
There are different syntaxes for things like variable table rows with arrays, manipulating charts, embedding images and videos, and overwriting existing styles. Your template can of course contain multiple slides, and your output can repeat any of those slides any number of times.
For a full list of features and how to use them, please refer to our API Docs.
Test driving the API on the Web Console
You can try out the SlidePack API without writing client code by using the Web Console.
You'll need to sign up for an account if you haven't yet.
After logging in,
- Go to Sessions and click Create New Session.
- Click Upload Zip on your newly created session.
- Select your zip and upload. (Grab a sample zip here)
- Click Upload Zip and Render.
- If your render is successful, you'll be taken back to the Sessions page where you can download the output file.
Using the API
From here on we'll guide you through how to render a PPTX programmatically through the API.
Create your API token
Authentication is done with a Bearer token in the HTTP header. Click Create New API Token in the Dashboard. to get yours. Copy and paste this token somewhere safe, and make sure you don't share it with anyone.
Create a Session
The first thing to do is create a rendering Session. We'll refer to the created Session UUID when we upload, render, and download files for this particular rendering run.
Issue a POST request like so:
curl -X "POST" "https://slidepack.io/sessions" \
-H 'Authorization: Bearer {api_token}'
to get a response like:
{
"session": {
"uuid": "f0155f9f-d3f3-4fa9-9f8d-70f8fd2f9c36",
"is_rendered": null,
"message": null,
"created_at": "2020-08-13T13:14:32.000000Z",
"updated_at": "2020-08-13T13:14:32.000000Z"
},
"upload": {
"action": "https://slidepack-api.s3.ap-northeast-1.amazonaws.com",
"method": "POST",
"enctype": "multipart/form-data",
"params": {
"acl": "private",
"key": "sessions/zip/f0155f9f-d3f3-4fa9-9f8d-70f8fd2f9c36.zip",
"Content-Type": "application/zip",
"X-Amz-Security-Token": "***",
"X-Amz-Credential": "***",
"X-Amz-Algorithm": "AWS4-HMAC-SHA256",
"X-Amz-Date": "20200813T131432Z",
"Policy": "***",
"X-Amz-Signature": "***"
}
}
}
session
contains general info about this session along with its UUID. upload
contains parameters needed for the upload step.
Upload your zip file
You'll be uploading your input zip file directly to SlidePack's S3 bucket using multipart/form-data.
A minimum input zip needs to contain:
- template.pptx - A PPTX file with placeholders
- data.json - Data to populate the template with
You can browse our examples to get started.
All the information you need for this step is provided in the upload
field of the session data received in the previous step:
-
upload.action
is the URL you'll be POSTing to -
upload.params
is the form data to POST along with your file
We just need to add the actual file:
curl -X "POST" "https://slidepack-api.s3.ap-northeast-1.amazonaws.com/" \
-F "acl=private" \
-F "key=sessions/zip/{uuid}.zip" \
-F "Content-Type=application/zip" \
-F "X-Amz-Security-Token=***" \
-F "X-Amz-Credential=***" \
-F "X-Amz-Algorithm=AWS4-HMAC-SHA256" \
-F "X-Amz-Date=***" \
-F "Policy=***" \
-F "X-Amz-Signature=***" \
-F "file=@/path/to/your/data.zip"
You'll get a 204 No Content
if your upload is successful.
Render and download output file
Once uploading is done, we tell SlidePack to execute the render.
We do this by POSTing to https://slidepack.io/sessions/{uuid}/render
, where uuid
is session.uuid
received in the session info.
curl -X "POST" "https://slidepack.io/sessions/{uuid}/render" \
-H 'Authorization: Bearer {api_token}'
You'll get a response like this:
{
"session": {
"uuid": "f0155f9f-d3f3-4fa9-9f8d-70f8fd2f9c36",
"is_rendered": true,
"message": "Render succeeded.",
"created_at": "2020-08-13T13:14:32.000000Z",
"updated_at": "2020-08-13T13:17:43.000000Z"
},
"download_url": "https://slidepack-api.s3.ap-northeast-1.amazonaws.com/..."
}
Now all you need to do is get the output file from the download_url
:
curl "https://slidepack-api.s3.ap-northeast-1.amazonaws.com/..." -o output.pptx
(Or, you can visit that URL in your browser.)
Feedback welcome!
That's all for a quick run through the basics of SlidePack. Let us know in the comments if you get stuck or have any questions.
We're not a well known service, but we've been serving non-trivial business uses for several years now.
We are constantly adding and refining features too. Any feedback/feature requests are welcome!
Contact form: https://slidepack.io/en/contact
Our rep Satoshi Kita on twitter: https://twitter.com/kitar
Top comments (0)