跳到内容

Pushwoosh API 概述

Pushwoosh API 允许开发者与 Pushwoosh 平台进行交互。

您可以使用 Pushwoosh API 做什么?

Anchor link to

通过 Pushwoosh API,您可以访问包含 100 多种方法的广泛库,使您能够:

  • 发送个性化的 Push 通知(推送通知)
  • 创建、导入、导出和管理用户 Segment(细分受众群),以实现精准定位
  • 利用批量 API 批量管理用户/设备
  • 配置应用程序
  • 跟踪用户 Event(事件)并为用户添加 Tag(标签),以增强定位和个性化
  • 创建和管理 Pushwoosh 实体,例如 Preset(预设)、Tag(标签)、Event(事件)、应用程序等
  • 通过 API 启动 Pushwoosh Customer Journeys(客户旅程)
  • 检索 Customer Journeys(客户旅程)以及 Push/Email/SMS Campaigns(推送/电子邮件/短信营销活动)的全面统计数据
  • 实施地理围栏,以便在用户进入或退出特定地理区域时发送基于位置的通知
  • 将第三方服务与 Pushwoosh 无缝集成

要探索所有可用方法并了解 Pushwoosh API 的广泛功能,请参阅 API 方法参考索引

身份验证

Anchor link to

Pushwoosh API 使用 API Token(API令牌)来验证请求。Token 有两种类型:服务器设备,每种用于特定的 API 范围。

每个 Pushwoosh 账户都带有一个为 Pushwoosh Demo App 创建的默认 API Access Token(API访问令牌)。您可以在 Pushwoosh Control Panel(控制面板)中查看、创建和管理您的 API Token。

速率限制

Anchor link to

速率限制是 API 在给定时间内可以接收的请求数量。虽然 Pushwoosh 中的大多数 API 请求不受限制,但 /createMessage API 请求的上限为每分钟 600 次,以确保所有用户的服务质量。

所有 API 请求都强制使用 HTTPS,以确保安全的数据传输。

Pushwoosh API 通常返回 JSON 响应。

成功和错误代码

Anchor link to

成功代码

Anchor link to

当您的 API 请求成功处理后,您将收到一个成功代码作为响应的一部分。

HTTP status code
Status messageDescription
200OKPushwoosh 成功处理了请求

请注意,当您收到 HTTP 200 响应时,这表示您的请求已被理解并成功处理,但这并不保证操作的成功。因此,请务必检查错误或警告消息(例如:访问被拒绝、找不到应用程序、API 密钥无效等),以确定操作是否成功。

Status code
Status message
200Warnings: You have reached the subscriber limit. Push Message will be sent to 1 random device only
200警告:您已达到订阅者限制。Push 消息将仅发送到 1 个随机设备
200Warnings: You have exceeded the number of active devices allowed on your current subscription plan.
200警告:您已超出当前订阅计划允许的活跃设备数量。
210Access denied or application not found
210访问被拒绝或找不到应用程序
210Application not found
210找不到应用程序
210Application suspended
210应用程序已暂停
210Account not found
210找不到账户
210Account has been suspended
210账户已暂停
210Suspended account can not use device filtration
210已暂停的账户无法使用设备过滤
210API token or application is not set
210未设置 API Token 或应用程序
210Please select at least one platform
210请至少选择一个平台
210Invalid API Token: Account not found
210无效的 API Token:找不到账户
210No application or group code given
210未提供应用程序或组代码
210API token or application or account is not set
210未设置 API Token、应用程序或账户

错误代码

Anchor link to

如果您的请求格式不正确、遇到处理问题或出现任何其他错误,Pushwoosh 将向您发送一个错误代码,指示问题的性质,帮助您有效地排查和解决问题。

HTTP status code
Status messageDescription
400Bad request错误请求
400The request can not be fulfilled due to bad syntax由于语法错误,请求无法完成
401Unauthorized未经授权
401Authentication has failed or hasn’t been provided身份验证失败或未提供
403Token restrictions forbid this operation.Token 限制禁止此操作。
403Your access token lacks the necessary permissions to perform the requested action. To fix this, review your access token’s permissions in the Pushwoosh control panel and adjust them as needed to match the requirements for the specific operation you want to carry out.您的访问 Token 缺少执行请求操作所需的权限。要解决此问题,请在 Pushwoosh 控制面板中查看您的访问 Token 的权限,并根据需要进行调整,以匹配您要执行的特定操作的要求。
404Resource not found未找到资源
404Indicates that the requested resource, such as an app, could not be located or does not exist on the server.表示请求的资源(例如应用程序)无法找到或服务器上不存在。
500Internal error内部错误
500There was an unexpected issue or error on the server while processing the API request.在处理 API 请求时,服务器上发生了一个意外问题或错误。