• API 功能

    • 支持将 PPT 文件转换为高质量图片序列;
    • 支持导出图片的高清放大,最大为 4 倍高清导出;
    • 支持 .ppt 和 .pptx 格式;
    • 保持原始 PPT 的布局和样式;
    • 转换后的图片支持永久访问;
    • 全接口支持 HTTPS(TLS v1.0 / v1.1 / v1.2 / v1.3);
    • 全面兼容 Apple ATS;
    • 全国多节点 CDN 部署;
    • 接口极速响应,多台服务器构建 API 接口负载均衡。
    • 接口调用状态与状态监控
  • API 文档

    接口地址: https://api.gugudata.com/imagerecognition/ppt-to-images?appkey={{YOUR_APPKEY}}&scale_factor={{scale_factor}}

    返回格式: application/json; charset=utf-8

    请求方式: POST

    请求协议: HTTPS

    请求示例: https://api.gugudata.com/imagerecognition/ppt-to-images?appkey={{YOUR_APPKEY}}&scale_factor={{scale_factor}}

    数据预览: https://www.gugudata.com/preview/ppt-to-images

    接口测试:  https://api.gugudata.com/imagerecognition/ppt-to-images/demo

    OpenAPI: https://www.gugudata.com/openapi/gugudata.openapi.3.1.json

    请求参数(POST 请求参数以 application/x-www-form-urlencoded 格式、文件流以 formdata 格式传递,具体可参见下方示例代码)

    参数名 参数类型 是否必须 默认值 备注
    scale_factor number 1 图片导出缩放因子,默认为 1,最大为 4 倍高清模式
    file string/binary PPT 文件,支持 .ppt 和 .pptx 格式
    url string 不传递 PPT 文件流,可直接传递可访问的 PPT 文件地址

    返回参数

    参数名 参数类型 备注
    DataStatus.RequestParameter string 请求参数字符串
    DataStatus.StatusCode integer 接口返回状态码
    DataStatus.StatusDescription string 接口返回状态说明
    DataStatus.ResponseDateTime string 接口数据返回时间
    DataStatus.DataTotalCount integer 转换后的图片总数
    Data array 转换后的图片 URL 数组,支持永久存储
  • 接口 HTTP 响应标准状态码

    状态码 状态码解释 备注
    200 接口正常响应 请求成功,业务状态请结合响应体中的自定义业务码判断。
    400 请求参数错误 请求参数缺失、格式错误或参数组合不合法。
    401 鉴权失败 缺少 appkey 或 appkey 无效。
    403 无权限访问 订单到期、权限不足或接口额度不可用。
    404 资源不存在 请求路径不存在。
    405 请求方法不允许 当前路径不支持该 HTTP 方法。
    415 请求内容类型不支持 上传或请求体的内容类型不符合接口要求。
    429 请求频率受限 一般建议同一个 IP 每秒请求不超过 5 次 (QPS<=5),我们不限制同一个 key 的请求总次数,但当单位时间内同一个 IP 请求次数过多,或 AI CDN 判定为恶意抓取数据、流量攻击等异常时,CDN 会返回此状态码,请适当降低请求频率。如有特殊大并发请求场景需求,可联系我们添加白名单处理。
    500 服务内部错误 服务端处理异常,请稍后重试。
    502 上游依赖错误 上游依赖服务不可用或返回异常。
  • 接口自定义状态码

    自定义状态码 自定义状态码解释 备注
    100 正常返回
    101 参数错误
    102 请求频率受限 一般建议同一个 IP 每秒请求不超过 5 次 (QPS<=5),我们不限制同一个 key 的请求总次数,但当单位时间内同一个 IP 请求次数过多,或 AI CDN 判定为恶意抓取数据、流量攻击等异常时,CDN 会返回此状态码,请适当降低请求频率。如有特殊大并发请求场景需求,可联系我们添加白名单处理。
    103 账号欠费
    104 APPKEY 错误 请检查传递的 APPKEY 是否为开发者中心获取到的值
    110 接口响应错误
  • 请求示例代码
    curl --location 'https://api.gugudata.com/imagerecognition/ppt-to-images?appkey={{YOUR_APPKEY}}&scale_factor={{scale_factor}}' \
    --form 'url=' \
    --form 'file=@localfile_path.png'
    #include <curl/curl.h>
    
    int main(void) {
      CURL *curl = curl_easy_init();
      if (curl) {
        curl_easy_setopt(curl, CURLOPT_URL, "https://api.gugudata.com/imagerecognition/ppt-to-images?appkey={{YOUR_APPKEY}}&scale_factor={{scale_factor}}");
        curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
        curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
        curl_mime *mime = curl_mime_init(curl);
        curl_mimepart *part = NULL;
        part = curl_mime_addpart(mime);
        curl_mime_name(part, "url");
        curl_mime_data(part, "", CURL_ZERO_TERMINATED);
        part = curl_mime_addpart(mime);
        curl_mime_name(part, "file");
        curl_mime_filedata(part, "localfile_path.png");
        curl_easy_setopt(curl, CURLOPT_MIMEPOST, mime);
        CURLcode res = curl_easy_perform(curl);
        (void)res;
        curl_mime_free(mime);
        curl_easy_cleanup(curl);
      }
      return 0;
    }
    
    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Net.Http;
    
    var client = new HttpClient();
    var request = new HttpRequestMessage(HttpMethod.Post, "https://api.gugudata.com/imagerecognition/ppt-to-images?appkey={{YOUR_APPKEY}}&scale_factor={{scale_factor}}");
    var content = new MultipartFormDataContent();
    content.Add(new StringContent(""), "url");
    content.Add(new StreamContent(File.OpenRead("localfile_path.png")), "file", "localfile_path.png");
    request.Content = content;
    var response = client.SendAsync(request).Result;
    Console.WriteLine(response.Content.ReadAsStringAsync().Result);
    
    package main
    
    import (
      "bytes"
      "mime/multipart"
      "os"
      "path/filepath"
      "fmt"
      "io"
      "net/http"
    )
    
    func main() {
      url := "https://api.gugudata.com/imagerecognition/ppt-to-images?appkey={{YOUR_APPKEY}}&scale_factor={{scale_factor}}"
      payload := &bytes.Buffer{}
      writer := multipart.NewWriter(payload)
      _ = writer.WriteField("url", "")
      file, err := os.Open("localfile_path.png")
      if err != nil {
        fmt.Println(err)
        return
      }
      defer file.Close()
      part, err := writer.CreateFormFile("file", filepath.Base("localfile_path.png"))
      if err != nil {
        fmt.Println(err)
        return
      }
      if _, err = io.Copy(part, file); err != nil {
        fmt.Println(err)
        return
      }
      if err := writer.Close(); err != nil {
        fmt.Println(err)
        return
      }
      req, err := http.NewRequest("POST", url, payload)
      if err != nil {
        fmt.Println(err)
        return
      }
      req.Header.Set("Content-Type", writer.FormDataContentType())
      res, err := http.DefaultClient.Do(req)
      if err != nil {
        fmt.Println(err)
        return
      }
      defer res.Body.Close()
      body, err := io.ReadAll(res.Body)
      if err != nil {
        fmt.Println(err)
        return
      }
      fmt.Println(string(body))
    }
    
    OkHttpClient client = new OkHttpClient().newBuilder().build();
    RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
      .addFormDataPart("url", "")
      .addFormDataPart("file", "localfile_path.png",
        RequestBody.create(MediaType.parse("application/octet-stream"), new File("localfile_path.png")))
      .build();
    Request request = new Request.Builder()
      .url("https://api.gugudata.com/imagerecognition/ppt-to-images?appkey={{YOUR_APPKEY}}&scale_factor={{scale_factor}}")
      .method("POST", body)
      .build();
    Response response = client.newCall(request).execute();
    System.out.println(response.body().string());
    
    var form = new FormData();
    form.append("url", "");
    form.append("file", fileInput.files[0], "localfile_path.png");
    
    $.ajax({
      url: "https://api.gugudata.com/imagerecognition/ppt-to-images?appkey={{YOUR_APPKEY}}&scale_factor={{scale_factor}}",
      method: "POST",
      data: form,
      processData: false,
      contentType: false
    }).done(function (response) {
      console.log(response);
    });
    
    const formData = new FormData();
    formData.append("url", "");
    formData.append("file", fileInput.files[0], "localfile_path.png");
    
    const response = await fetch("https://api.gugudata.com/imagerecognition/ppt-to-images?appkey={{YOUR_APPKEY}}&scale_factor={{scale_factor}}", {
      method: "POST",
      body: formData
    });
    console.log(await response.text());
    
    import { readFile } from "node:fs/promises";
    
    const formData = new FormData();
    formData.append("url", "");
    formData.append("file", new Blob([await readFile("localfile_path.png")], { type: "application/octet-stream" }), "localfile_path.png");
    
    const response = await fetch("https://api.gugudata.com/imagerecognition/ppt-to-images?appkey={{YOUR_APPKEY}}&scale_factor={{scale_factor}}", {
      method: "POST",
      body: formData
    });
    console.log(await response.text());
    
    #import <Foundation/Foundation.h>
    
    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.gugudata.com/imagerecognition/ppt-to-images?appkey={{YOUR_APPKEY}}&scale_factor={{scale_factor}}"]];
    [request setHTTPMethod:@"POST"];
    NSString *boundary = [[NSUUID UUID] UUIDString];
    NSMutableData *body = [NSMutableData data];
    [body appendData:[[NSString stringWithFormat:@"--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];
    [body appendData:[@"Content-Disposition: form-data; name=\"url\"\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]];
    [body appendData:[@"\r\n" dataUsingEncoding:NSUTF8StringEncoding]];
    NSData *fileData = [NSData dataWithContentsOfFile:@"localfile_path.png"];
    [body appendData:[[NSString stringWithFormat:@"--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];
    [body appendData:[@"Content-Disposition: form-data; name=\"file\"; filename=\"localfile_path.png\"\r\n" dataUsingEncoding:NSUTF8StringEncoding]];
    [body appendData:[@"Content-Type: application/octet-stream\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]];
    [body appendData:fileData];
    [body appendData:[@"\r\n" dataUsingEncoding:NSUTF8StringEncoding]];
    [body appendData:[[NSString stringWithFormat:@"--%@--\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];
    [request setValue:[NSString stringWithFormat:@"multipart/form-data; boundary=%@", boundary] forHTTPHeaderField:@"Content-Type"];
    [request setHTTPBody:body];
    NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
      if (error) {
        NSLog(@"%@", error);
        return;
      }
      NSLog(@"%@", [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]);
    }];
    [task resume];
    
    <?php
    $curl = curl_init();
    curl_setopt_array($curl, array(
      CURLOPT_URL => "https://api.gugudata.com/imagerecognition/ppt-to-images?appkey={{YOUR_APPKEY}}&scale_factor={{scale_factor}}",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_FOLLOWLOCATION => true,
      CURLOPT_CUSTOMREQUEST => "POST",
      CURLOPT_POSTFIELDS => array(
        "url" => "",
        "file" => new CURLFile("localfile_path.png", "application/octet-stream", "localfile_path.png"),
      ),
    ));
    $response = curl_exec($curl);
    curl_close($curl);
    echo $response;
    
    import requests
    
    url = "https://api.gugudata.com/imagerecognition/ppt-to-images?appkey={{YOUR_APPKEY}}&scale_factor={{scale_factor}}"
    payload = { "url": "" }
    files = {
        "file": ("localfile_path.png", open("localfile_path.png", "rb"), "application/octet-stream"),
    }
    try:
        response = requests.post(url, data=payload, files=files)
        print(response.text)
    finally:
        for _, file_handle, _ in files.values():
            file_handle.close()
    
    require "uri"
    require "net/http"
    
    url = URI("https://api.gugudata.com/imagerecognition/ppt-to-images?appkey={{YOUR_APPKEY}}&scale_factor={{scale_factor}}")
    https = Net::HTTP.new(url.host, url.port)
    https.use_ssl = true
    request = Net::HTTP::Post.new(url)
    files = [
      File.open("localfile_path.png"),
    ]
    begin
      form_data = [
        ["url", ""],
        ["file", files[0], { filename: "localfile_path.png" }],
      ]
      request.set_form form_data, "multipart/form-data"
      response = https.request(request)
      puts response.read_body
    ensure
      files.each(&:close)
    end
    
    import Foundation
    
    let semaphore = DispatchSemaphore(value: 0)
    var request = URLRequest(url: URL(string: "https://api.gugudata.com/imagerecognition/ppt-to-images?appkey={{YOUR_APPKEY}}&scale_factor={{scale_factor}}")!, timeoutInterval: .infinity)
    request.httpMethod = "POST"
    let boundary = "Boundary-\(UUID().uuidString)"
    var body = Data()
    func appendString(_ value: String) { body.append(value.data(using: .utf8)!) }
    appendString("--\(boundary)\r\n")
    appendString("Content-Disposition: form-data; name=\"url\"\r\n\r\n")
    appendString("\r\n")
    let fileData = try! Data(contentsOf: URL(fileURLWithPath: "localfile_path.png"))
    appendString("--\(boundary)\r\n")
    appendString("Content-Disposition: form-data; name=\"file\"; filename=\"localfile_path.png\"\r\n")
    appendString("Content-Type: application/octet-stream\r\n\r\n")
    body.append(fileData)
    appendString("\r\n")
    appendString("--\(boundary)--\r\n")
    request.addValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type")
    request.httpBody = body
    let task = URLSession.shared.dataTask(with: request) { data, response, error in
      defer { semaphore.signal() }
      guard let data = data else {
        print(String(describing: error))
        return
      }
      print(String(data: data, encoding: .utf8)!)
    }
    task.resume()
    semaphore.wait()
    
  • 常见问题 Q&A

    • Q: 数据请求有缓存吗?

      A: 我们为所有数据请求提供实时响应。对于定期更新的数据,我们在其更新周期内实施缓存策略,以优化性能。

    • Q: 如何保证请求时 key 的安全性?

      A: 我们建议将对 API 的请求操作放置在您的应用程序后端。这样,前端请求只与您的后端服务交互,确保了更高的安全性和易于维护的架构。

    • Q: 接口可以用于哪些开发语言?

      A: 我们的接口支持所有能进行网络请求的开发语言,便于在各类项目中快速整合数据。

    • Q: 接口的性能可以保证吗?

      A: 我们的接口后台使用与商业级项目相同的架构,保证了稳定且高效的性能。您可以通过访问测试接口了解更多性能信息。

  • 服务协议以及服务免责声明

    用户应当充分阅读 服务协议 以及 服务免责声明 ,用户购买与使用咕咕数据 API 服务亦视为接受本协议。

  • 技术支持

    • 技术支持邮箱: support@gugudata.com
    • 微信客服: 客服链接

业务相关接口推荐

稳定提供服务 10 年 通用 PDF 文件流 OCR 到文本
  • 高可用图像识别引擎
  • 基于机器学习 / 高效文本提取
  • 1999元/年限时折扣 999元/年
查看详情 被调用于 4 秒前
50% 折扣
图片压缩与尺寸优化
  • 图片压缩优化,保持长宽比,保证清晰度
  • 图片压缩 / 图片优化 / 尺寸调整
  • 999元/年限时折扣 499元/年
查看详情 被调用于 2 秒前
50% 折扣
PDF 转 HTML
  • 高效 PDF 转 HTML 工具
  • 生成HTML站点 / 可永久存储
  • 999元/年限时折扣 499元/年
查看详情 被调用于 3 秒前
50% 折扣
PDF 分割拆分
  • 高效的 PDF 分割工具
  • 高效处理 / 可永久存储
  • 999元/年限时折扣 499元/年
查看详情 被调用于 9 秒前
50% 折扣