Building your JSON payload

and configuring your presentation.

Here we outline the component parts of the JSON payload necessary for creating a presentation.

Referencing your template PowerPoint file

First you must tell the API where to retrieve the PowerPoint file that contains the slides you intend to use as templates for your presentation. You will either refer to the template PowerPoint file by its name, or the link where it can be downloaded.

In this case we are sending the template PowerPoint file directly with the POST request:

{
  "presentation": {
    "template": "slides_as_template.pptx",
    "export_version": "Pptx2010",
    ....

Refer to Templating your presentation for more on sharing template PowerPoint files.

Defining your slides:

For each slide you want to create, you will need to build an object in the "slides" array:

....
  "slides": [
    {
      ...shape objects...
    }
  ]
....

Template type and which slide to use:

For each slide object you are required to specify the type of slide you want to use as template. In this case we are using a slide from our template PowerPoint file.

Additionally you are required to choose which template slide to use as template for your new slide (zero-based):

....
  "type": "slide",
  "slide_index": 0,
....

Updating your shapes

Within your slide object you can refer to an array of shape objects.

Everything on a slide is a shape. Each shape object has a name. To select and populate a specific shape, you must reference it by name. To find a specific shape by name see here. Then you can specify the content you want placed into that shape on your slide. In this case we are adding a string to a text shape:

....
  "shapes": [
    {
      "name": "Title 1",
      "content": "Automate PowerPoint Generation"
    }
  ]
....

Complete example payload

Payload below will generate a PowerPoint presentation with two slides, populating a textbox on slide one and a chart on slide two whilst retaining the styling of the two slides from the template PowerPoint file:

Template Presentation

JSON Payload

{
   "presentation":{
      "template":"slides_as_template.pptx",
      "export_version":"Pptx2010",
      "slides":[
         {
            "type":"slide",
            "slide_index":0,
            "shapes":[
               {
                  "name":"Title 1",
                  "content":"Automate PowerPoint Generation"
               }
            ]
         },
         {
            "type":"slide",
            "slide_index":1,
            "shapes":[
               {
                  "name":"Chart 14",
                  "title":"Average Annual Precipitations",
                  "data":[
                     [
                        "North",
                        "South",
                        "East",
                        "West"
                     ],
                     [
                        "January",
                        "February",
                        "March"
                     ],
                     [
                        11,
                        15,
                        4,
                        7
                     ],
                     [
                        25,
                        60,
                        77,
                        30
                     ],
                     [
                        40,
                        50,
                        65,
                        44
                     ]
                  ]
               }
            ]
         }
      ]
   }
}

Using above payload, create a presentation using slide as template

POST https://gen.powerpointgeneratorapi.com/v1.0/generator/create

Headers

NameTypeDescription

Content-Type*

string

multipart/form-data

Authorization*

string

Bearer authorization token

Request Body

NameTypeDescription

files

object

PPTX file used as styling and layout template

jsonData*

string

JSON payload which contains the presentation definition

Last updated