SuperAPI AI 工具集

telnyx-porting-out-curl

部署与运维

查看项目

更新于 10-16 03:56

技能介绍

Telnyx Porting Out - curl 是一个基于 Telnyx REST API 的技能,专注于号码从 Telnyx 转出(port-out)时的管理操作。它提供了一系列 curl 命令示例,供开发者在命令行或脚本中调用 Telnyx API,完成对 port-out 请求的查询、更新与相关资源管理。

用途 该技能用于处理号码被转出 Telnyx 时的 port-out 请求。通过它,可以列出、查看和更新 port-out 状态,并管理与之相关的评论、支持文档、事件和报告。

主要能力

  • 列出 portout 请求:GET /portouts,支持通过查询参数进行过滤,返回字段包括 already_ported、authorized_name、carrier_name、city、created_at、current_carrier、end_user_name、foc_date、host_messaging、id、inserted_at、lsr、phone_numbers、pon、reason、record_type、rejection_code、requested_foc_date、service_address、spid、state、status(pending、authorized、ported、rejected、rejected-pending、canceled)、support_key、updated_at、user_id、vendor、zip 等。
  • 查看单个 portout 请求:GET /portouts/{id},返回与列表相同的字段结构。
  • 列出所有 port-out 事件:GET /portouts/events,返回 available_notification_methods、created_at、event_type(portout.status_changed、portout.foc_date_changed、portout.new_comment)、id、payload、payload_status(created、completed)、portout_id、record_type、updated_at。
  • 查看特定 port-out 事件:GET /portouts/events/{id}。
  • 重发 port-out 事件:POST /portouts/events/{id}/republish。
  • 列出特定订单可用的 port-out 拒绝代码:GET /portouts/rejections/{portout_id},返回 code、description、reason_required。
  • 列出 port-out 相关报告:GET /portouts/reports,返回 created_at、document_id、id、params、record_type、report_type(export_portouts_csv)、status(pending、completed)、updated_at。
  • 创建 port-out 相关报告:POST /portouts/reports。
  • 检索特定报告:GET /portouts/reports/{id}。
  • 列出 portout 请求的所有评论:GET /portouts/{id}/comments,返回 body、created_at、id、portout_id、record_type、user_id。
  • 在 portout 请求上创建评论:POST /portouts/{id}/comments,可选 body 字段。
  • 列出 portout 请求上的支持文档:GET /portouts/{id}/supporting_documents,返回 created_at、document_id、id、portout_id、record_type、type(loa、invoice)、updated_at。
  • 在 portout 请求上创建支持文档列表:POST /portouts/{id}/supporting_documents,可选 documents 数组。
  • 更新状态:PATCH /portouts/{id}/{status},用于授权或拒绝 portout 请求,必填 reason,可选 host_messaging。

使用方式 该技能以 curl 命令示例呈现。curl 在 macOS、Linux 和 Windows 10+ 上已预装。使用前需设置环境变量:export TELNYX_API_KEY="YOUR_API_KEY_HERE"。所有示例均使用 $TELNYX_API_KEY 进行认证,请求头为 Authorization: Bearer $TELNYX_API_KEY。

错误处理 所有 API 调用可能因网络错误、速率限制(429)、验证错误(422)或认证错误(401)而失败。生产代码中应始终处理错误。示例中通过 -w "\n%{http_code}" 获取 HTTP 状态码,并针对 2*、422、429、401 等状态码分别处理。常见错误码:401 无效 API 密钥,403 权限不足,404 资源未找到,422 验证错误(检查字段格式),429 速率限制(使用指数退避重试)。

分页 列表端点返回分页结果。使用 page[number] 和 page[size] 查询参数导航页面,并检查响应中的 meta.total_pages。

适用场景 适用于需要以命令行或脚本方式集成 Telnyx 号码转出管理流程的开发者,例如批量查询 port-out 请求、跟踪事件、管理评论与文档、生成报告,以及授权或拒绝转出请求。

限制 该技能仅提供 REST API 的 curl 示例,不包含其他语言 SDK 或图形界面。具体功能、收费、价格、平台支持范围等未在资料中提供,需参考 Telnyx 官方文档。