Uber Direct API创建配送返回invalid restaurant gateway request错误求助
排查Uber Direct API创建配送时"invalid restaurant gateway request"错误
以下是针对你遇到的错误的具体排查方向和修改建议:
1. 修复无效的电话号码格式
你的请求中dropoff_phone_number(+0299)和pickup_phone_number(+72704)不符合E.164标准,Uber API要求完整的有效电话号码(沙箱环境可使用测试号码如+15551234567)。无效号码会触发网关验证失败。
修改示例:
"dropoff_phone_number": "+15551234567", "pickup_phone_number": "+15559876543"
2. 替换所有占位符内容
请求中存在<string>占位符(barcodes.value、manifest_reference、idempotency_key),这些占位符需要替换为符合格式的实际值,沙箱环境不接受未填充的占位符参数。
修改示例:
"barcodes": [ { "value": "TEST12345", "type": "CODE128" } ], "manifest_reference": "ORDER-1234", "idempotency_key": "UNIQUE-ID-9876"
3. 解决pickup_verification字段冲突
- 你同时设置了
signature: true和signature_requirement.enabled: true,属于重复配置,建议仅保留signature_requirement结构。 identification.min_age: 18与requires_id: false存在逻辑冲突:要求年龄验证需要开启身份验证,需将requires_id改为true,或者移除identification配置。
修改示例(移除重复配置并修正逻辑):
"pickup_verification": { "signature_requirement": { "enabled": true, "collect_signer_name": true, "collect_signer_relationship": false }, "barcodes": [ { "value": "TEST12345", "type": "CODE128" } ], "picture": false }, "requires_id": false, "requires_dropoff_signature": true
(若需要年龄验证,则将requires_id设为true并保留identification字段)
4. 移除或调整test_specifications参数
沙箱环境中robo_courier_specification的auto模式可能不适用于当前配送场景(如药品配送),尝试移除该字段后重新请求,避免触发网关验证错误。
5. 规范地址格式
pickup_address中的格式存在无空格的逗号(BOSTON, MA),调整为标准地址格式有助于Uber正确解析:
"pickup_address": "4 Liberty Square, Boston, MA 02109-4811, USA"
完成以上修改后,重新调用POST deliveries接口,应该可以解决当前的参数验证错误。
内容的提问来源于stack exchange,提问作者Rinaldo
相关产品推荐
相关产品推荐

