【发布时间】:2016-01-28 08:36:37
【问题描述】:
根据 square up 的文档,在获得个人访问令牌后,我应该能够通过 curl 的简单请求来检索商家 ID。但是,我收到一个错误。如何获取商家 ID 而不是异常?
来自https://docs.connect.squareup.com:
现在您可以使用您的个人访问令牌将您的第一个请求发送到 Connect API。
打开一个终端窗口并运行以下 curl 命令,在指示的位置提供您的个人访问令牌:
curl -H "Authorization: Bearer PERSONAL_ACCESS_TOKEN" https://connect.squareup.com/v1/me
文档中的预期结果:
{ "id": "JGHJ0343", "name": "Dave Davis", "email": "dave@example.com", "country_code": "US", "language_code": "en-US", "business_name": "Dave's Milkshakes", "business_address": { "address_line_1": "1455 Market St", "locality": "San Francisco", "administrative_district_level_1": "CA", "postal_code": "94103" }, "business_phone": { "calling_code": "+1", "number": "4155551234" }, "business_type": "restaurants", "account_type": "LOCATION" }
异常文本:
PS C:\Users\JMCC> curl -H "Authorization: Bearer PERSONAL_ACCESS_TOKEN" https://connect.squareup.com/v1/me
Invoke-WebRequest : Cannot bind parameter 'Headers'. Cannot convert the "Authorization: Bearer PERSONAL_ACCESS_TOKEN" value of type "System.String" to type "System.Collections.IDictionary".
...
【问题讨论】:
-
您已根据您的问题编辑了屏幕截图,因此现在它不可能对其他人有用。但是,评论历史仍然可以在 diff 中看到,因此您的个人访问令牌仍然是公开的。您需要生成一个新的个人访问令牌,这将使旧的无效。
标签: curl square-connect