3

我正在尝试通过 Marketo 的 REST API批量更新一堆现有记录。根据文档, Import Lead 功能似乎是理想的选择。

简而言之,我在使用文档中的 curl 示例时收到错误“610 Resource Not Found”。这是我采取的一些步骤。

  1. 获取 auth_token 不是问题:
$ curl "https://<identity_path>/identity/oauth/token?
    grant_type=client_credentials&client_id=<my_client_id>
    &client_secret=<my_client_secret>"
  1. 证明令牌有效,获取单个潜在客户也不是问题:
# Fetch the record - outputs just fine
$ curl "https://<rest_path>/rest/v1/lead/1.json?access_token=<access_token>"

# output:
{
  "requestId": "ab9d#12345abc45",
  "result": [
    {
      "id": 1,
      "updatedAt": "2014-09-18T13:00:00+0000",
      "lastName": "Potter",
      "email": "harry@hogwartz.co.uk",
      "createdAt": "2014-09-18T12:00:00+0000",
      "firstName": "Harry"
    }
  ],
  "success": true
}
  1. 现在很痛苦,当我尝试使用Import Lead 功能上传 CSV 文件时。像这样:
# "Import Lead" function
$ curl -i -F format=csv -F file=@test.csv -F access_token=<access_token> 
    "https://<rest_path>/rest/bulk/v1/leads.json"

# results in the following error
{
  "requestId": "f2b6#14888a7385a",
  "success": false,
  "errors": [
    {
      "code": "610",
      "message": "Requested resource not found"
    }
  ]
}

错误代码文档仅说明Requested resource not found ,仅此而已。所以我的问题是:是什么导致了 610 错误代码 -我该如何解决

我尝试了进一步的步骤,但没有成功:

  • 将 access_token 作为 url 参数放置(例如,将 '?access_token=xxx' 附加到 url),没有效果。
  • 将 CSV(是的,它是逗号分隔的)剥离到最低限度(例如,只有字段 'id' 和 'lastName')
  • 看了问题Marketo API and Python, Post request failed
  • 已验证 CSV 没有一些时髦的行尾
  • 我不知道 CSV 文件是否有特定要求,例如列顺序,不过......

有什么提示或建议吗?

4

2 回答 2

2

错误代码 610 可以表示类似于 REST 端点下 url 的“404”,即您的rest_path. 我猜这就是你得到“404”的原因:Marketo 的文档显示 REST 路径以“/rest”开头,但它们的 REST 端点以 /rest 结尾,所以如果你按照他们的指示,你会得到一个类似的 url xxxx.mktorest.com/rest/rest/v1/lead/...,,即用'/rest'两次。这是不正确的。您的网址必须只有一个“rest/”。

于 2014-09-18T22:44:29.720 回答
0

我遇到了同样的麻烦,只是想分享一些有助于解决我问题的观点。

  • 批量 API 端点不像其他端点那样以“/rest”为前缀。
  • 批量导入使用与 Marketo REST API 相同的权限模型,并且不需要任何额外的特殊权限即可使用,但每组端点都需要特定权限。
  • 正如@Ethan Herdrick 所建议的那样,文档中的端点有时会以 extra 为前缀/rest,请确保将其删除。

如果您是初学者并且需要分步说明来设置 Marketo REST API 的权限:Marketo REST API快速入门指南

于 2021-12-08T14:47:49.843 回答