This document provides best practices for the PPT generation API workflow to help you get started quickly and develop your own business applications.
1. Prerequisites
Backend
- Go to the PPT Generation Purchase Page to activate the service.
- Get a workspace ID.
- Get an API key.
- Import the Miaobi SDK. Ensure you use the latest version.
Frontend
- Resource URL: https://quanmiao-public.oss-cn-beijing.aliyuncs.com/quanmiao-sdk/v2.0.0/index.js
- Special configuration: API requests must support the
Refererattribute.
2. Procedure
Step 1: Generate a PPT outline
Step 2: Generate PPT content
Get PPT component configuration to obtain the code required for editing a PPT artifact.
Initialize PPT creationto obtain the parameters required for the PPT generation process.
- Note: This API call incurs charges. Be mindful of the costs.
-
Returned information:
- A
signatureto initialize the frontend component for PPT generation. - Other parameters required for different scenarios, such as the PPT process ID, artifact ID, and task ID.
- A
3. Use cases
Use case 1: Create a PPT end-to-end
This one-stop SaaS solution provides the full functionality of the console. The frontend SDK handles the entire workflow.
Step 1: Initialize the PPT creation session
Backend:
Call the Initialize PPT Creation API to initialize a PPT creation session. The following code shows an example:Frontend:
Globally load and initialize thequanmiao-sdk. The following code shows an example:
Step 2: Bind the PPT artifact data
Use case 2: Generate from a custom template
Step 1: Customize the template
You can call Query Enterprise PPT Templates to get test templates for this use case.
Step 2: Generate content from a template
Backend:
Use the backend API to get the required parameters.pptProcessId: Corresponds to theaipptTaskIdinput parameter of the frontend SDK.signature
Frontend:
In your business workflow, call the creation API. For editing or viewing workflows, see Use case 3. The following code shows an example:Use case 3: Cloud creation and frontend editing
Step 1: (Backend)Create the PPT artifact
Parameters returned:
pptProcessIdpptArtifactId: Corresponds to theidinput parameter (artifact ID) of the frontend SDK.
GetPptInfo API to retrieve the results.
- Initialize the creation. The following code shows an example.
- Poll for the
pptArtifactId. The following code shows an example.
Step 2: (Frontend) Edit or view the artifact
Use case 4: Cloud creation with polling for results
The service creates and exports the PPT artifact on the cloud, returning an exportTaskId.
Use this exportTaskId to poll the Query PPT Export Task Result API and retrieve the download link for the PPT file.
This is an asynchronous process, similar to Use case 3.
- Initiate the creation to get a
taskId. The following code shows an example.
- Poll the
GetPptInfoAPI by using thetaskIdto get theexportTaskId. The following code shows an example.
- Poll for the task result by using the
exportTaskId. The following code shows an example.
Use case 5: Cloud creation with download link polling
The PPT artifact is created and exported on the cloud. The service returns a file link.
This is an asynchronous process, similar to Use case 3.
- Initiate the creation to get a
taskId. The following code shows an example.
- Poll for the
exportFileLink. The following code shows an example.
4 One-Click Call Examples
To improve development efficiency and user experience, we provide complete demo code samples. You can call them with a single click for fast integration and debugging.
Backend:
Download the demo samples:- Java: ppt-generation-demo.zip
- Python: ppt-generation-demo-py.zip