JSON to PPTX Builder

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

JSON Example

{
	"base_settings": {
		"tracking_id": "0N1iCw5hdsBPrtxStETA123_-NzsWw2T0Bxao8oL3SI",
		"project_name": "demo project"
	},
	"global_chart_settings": {
		"bar": {
			"show_legend": "center",
			"show_legend_font_size": 11
		}
	},
	"body": [{
		"id": "zSTRw18JtjYl899TRxhUl1lGmKGtROWPv_c591sjh6E",
		"table_text": "IceCream Question",
		"question_text": "How likely is it that you eat ice cream in the morning?",
		"base_text": "Weighted Base (All Answering) : ALL",
		"deleted": false,
		"rows": [{
			"id": "choice-1111",
      "text": "Don't know",
      "visible" : true
		}, {
			"id": "choice-2222",
      "text": "Yes",
      "visible" : true
		}, {
			"id": "choice-3333",
			"text": "No"
		}],
		"columns": [{
			"id": "total",
			"text": "Total",
			"items": [{
				"id": "total",
				"text": "Total",
				"base": 1949.0,
				"data": [
					106.0,
					105.0,
					26.0
				]
			}]
		}, {
			"id": "gender",
			"text": "Gender",
			"items": [{
					"id": "male",
					"text": "Male",
          "base": 175.0,
          "selected" : true,
					"data": [
						0,
						105.0,
						26.0
					]
				},
				{
					"id": "female",
					"text": "Female",
					"base": 175.0,
					"data": [
						123,
						210.0,
						260.0
					]
				}
			]
		}],
		"view_settings": {
			"slide_master_index": 0,
			"slide_layout_index": 0,
			"placeholder_index": 0,
			"chart_type": "bar",
			"hide_percentage": true
		},
		"custom_obj": {
			"total_max_bytes_size": 300
		}
	}],
	"custom_obj": {
		"total_max_bytes_size": 300
	}

}

This is a minimal example of a json data request.

Python example using requests library

pptx_request.py
import requests
import json

token = "<YOUR_API_TOKEN>"
data_path = "example_data.json"

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

url = 'https://api.pptxbuilder.com/api/v1/convert_data_to_pptx'
headers = {}
headers['Authorization'] = 'Bearer ' + token

data = {
    'json_data' : (None, body)
}

response = requests.post(url, files=data, headers=headers)

print(response.json()['url'])

After running this example you should expect a response:

{
    "url": "https://pptxbuilder.com/builder/preview?token=<token>"
}

Last updated