JSON to PPTX

This page shows a simple example of how to get started with the endpoint JSON to PPTX

JSON Example

{
  "base_settings": {
    "file_name": "test_demo"
  },
  "body": [{
    "table_text": "Demo",
    "question_text": "What is Demo?",
    "base_text": "A Demo is something that is used for presentation!",
    "rows": ["Cardiology", "Endocrinology / Diabetology", "General Practice / Family Medicine", "Internal Medicine", "Other"],
    "columns": [{
      "text": "Total",
      "items": [{
        "text": "Total n=100",
        "base": 100,
        "data": [16, 5, 37, 42, 0]
      }]
    }, {
      "text": "Gender",
      "items": [{
        "text": "Male",
        "base": 100,
        "data": [16, 5, 37, 42, 0]
      }, {
        "text": "Female",
        "base": 100,
        "data": [20, 15, 47, 22, 10]
      }]
    }],
    "view_settings": {
      "slide_master_index": 0,
      "slide_layout_index": 0,
      "placeholder_index": 0,
      "chart_type": "bar"
    }
  }]
}

This is a minimal example of a json data request.

Python example using requests library

pptx_request.py
import requests

# preparing body for request
with open('example.json', 'rb') as f:
    body = f.read()

url = 'https://api.pptxbuilder.com/api/v1/convert'
headers = {"content-type": "application/json"}
headers['Authorization'] = 'Bearer ' + '<your-token>'

response = requests.post(url, data=body, headers=headers)
content = response.content

Converting request content to pptx with Python

disposition = response.headers['Content-Disposition']
file_name = disposition.split(';')[-1].strip().split('=')[1]
with open(file_name, 'wb') as w:
    w.write(content)

Last updated