我正在尝试执行curl命令
curl https://api-m.sandbox.paypal.com/v1/payments/payouts -H "Content-Type: application/json" -H "Authorization: Bearer %ACCESS_TOKEN%" -d '{ "sender_batch_header": { "sender_batch_id": "2014021801", "recipient_type": "EMAIL", "email_subject": "You have money!", "email_message": "You received a payment. Thanks for using our service!" }, "items": [{ "amount": { "value": "9.87", "currency": "USD" }, "sender_item_id": "201403140001", "recipient_wallet": "PAYPAL", "receiver": "%RECIEVER%" } ] }'
我遇到了错误
{"name":"VALIDATION_ERROR","message":"Invalid request - see details","debug_id":"4369a14fc159e","details":[{"location":"body","issue":"MALFORMED_REQUEST_JSON"}],"links":[]}curl: (3) URL using bad/illegal format or missing URL
curl: (3) unmatched brace in URL position 1:
{
^
我不认为我的JSON有什么问题,有人能帮我找出问题所在吗?
2条答案
按热度按时间q8l4jmvw1#
我将命令更改为如下所示,它现在可以工作了,至少就我所知:
反斜杠和专用双引号,无单引号
bakd9h0s2#
我用PHP测试了你的JSON,没问题。
**PHP代码:**它首先将JSON转换为数组并检查错误。
这是回应
您将问题标记为
python
,因此我将curl转换为python原始curl代码(不带逗号)的语法是正确的。
我将您的代码(不带反斜杠)复制到了一个在线转换实用程序中
Convert curl commands to Python
"它回来了"
然后我将目标语言更改为JSON,它给出了以下内容: