Quickstart

This page will guide you through your first SlidePack render using the HTTP API.

You will need an API token to interact with the SlidePack API. If you don't have one, please sign up / sign in to your Dashboard and create your token.

1. Prepare your template and data

Input to SlidePack is a zip file that contains two things:

  • template.pptx - A PowerPoint presentation with {placeholder} s that will get replaced with the supplied data values.

    A minimal PowerPoint slide that says {title}
  • data.json - Data to populate the template with. For the above template, a minimal data.json looks like:

    {
      "slides": [
        {
          "template": 1,
          "title": "Hello, World!"
        }
      ]
    }
    

Put these two files into a zip archive, and you are ready to start interacting with the API.

You can also download and try out one of the examples.

2. Create a Session

A Session holds state for a single rendering session.

Request to create a session

curl -X POST "https://slidepack.io/sessions" \
     -H 'Authorization: Bearer {API_TOKEN}'

Example data returned from POST /sessions

{
  "session": {
    "uuid": "f0155f9f-d3f3-4fa9-9f8d-70f8fd2f9c36",
    "created_at": "2020-08-13T13:14:32.000000Z",
    "rendered_at": null,
    "render_succeeded": null,
    "render_slide_count": null,
    "render_message": null
  },
  "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": "***"
    }
  }
}

The response includes parameters you need for the next step.

3. Upload input zip file

You'll be uploading your input zip file directly to SlidePack's S3 bucket.

Construct a POST request using values returned from the previous POST /sessions request.

  • Enctype is multipart/form-data.
  • POST URL should equal upload.action.
  • All entries from upload.params should be included as form fields.
  • file should be the last form field, pointing to your desired input file.

Example request to upload input 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"

If successful, you'll get a 204 No Content response.

4. Render and download the output

We request a render of this session by POSTing to /render:

Example request to render the output

curl -X POST "https://slidepack.io/sessions/{uuid}/render" \
     -H 'Authorization: Bearer {API_TOKEN}'

Example render response

{
  "session": {
    "uuid": "f0155f9f-d3f3-4fa9-9f8d-70f8fd2f9c36",
    "created_at": "2020-08-13T13:14:32.000000Z",
    "rendered_at": "2020-08-13T13:16:18.000000Z",
    "render_succeeded": true,
    "render_slide_count": 5,
    "render_message": null
  },
  "download_url": "https://slidepack-api.s3.ap-northeast-1.amazonaws.com/..."
}

Access the download_url to retrieve your rendered output file:

curl "https://slidepack-api.s3.ap-northeast-1.amazonaws.com/..." -o output.pptx

If you used the minimal example, this is what your output will look like:

Render output

Next steps