gpt4 book ai didi

walmart-api - Affiliate API 仅适用于 walmart.io "Try API"页面,但不适用于每个 curl 请求

转载 作者:行者123 更新时间:2023-12-04 04:16:43 24 4
gpt4 key购买 nike

您好,Affiliate API 支持团队,

我开始实现与 Affiliate API 的连接。

首先,我测试了“Taxonomy”和“Paginated Items”入口点。当我通过 walmart.io 尝试 API 页面请求时,传递所需的 header 然后一切正常,我得到了预期的响应。

但是,当我在笔记本电脑上使用 curl 命令执行相同的请求并传递相同的 header 和参数时,我得到错误响应

  • 对于“分页项目”{"errors":[{"code":4008,"message":"Missing itemId"}]}

  • for "Taxonomy"{"details":{"Description":"无法检索服务相关信息,请阅读强制 header 或 URI 规范的文档"}}

有关详细信息,请参阅下面的调试日志。

请指教。

致以最诚挚的问候和感谢

谢尔盖


日志:分页项

curl --verbose --compressed  -H "WM_CONSUMER.ID:X-removed-X"  -H "WM_CONSUMER.INTIMESTAMP:1583698692666"  -H "WM_SEC.KEY_VERSION:2"  -H "WM_SEC.AUTH_SIGNATURE:IBVm1uz8+6uNA6XwJjweUjJRBHavUPCNoTXf6aino0uDN1DWFfSpaZRd+aVeoxdKZKZ2b/fC/gAcZoaBAqD4s6GaqO719d3E//EfLiRUPPB0AxKgpmB2/E6mlv5BPz3Zuds8aubPgruOaDJG8GjbLF4pxsV2AbLTgBV8/XSc2N7RSl/Sv4xyC2YIENRYn+Xclt7seScNq+5tlhvPtXTBCYQ02ocrJJ+TbOcMFNrIhQicQ6nLi/yIvPXjptPLLfYKrJI29AqWaHN1+mEdVK8NhqF8WEAPO897I7eVgTIw76A6XzKgwexf9irSRbjW88UbBsxMTS/xbvZNg51GYMl8YA=="  -H "Accept:application/json"  "https://developer.api.walmart.com/api-proxy/service/affil/product/v2/items"
* Trying 104.90.152.88...
* TCP_NODELAY set
* Connected to developer.api.walmart.com (104.90.152.88) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: /etc/ssl/certs
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server accepted to use h2
* Server certificate:
* subject: C=US; ST=Arkansas; L=Bentonville; O=Wal-Mart Stores, Inc.; CN=prod.walmart.com
* start date: May 17 17:01:36 2019 GMT
* expire date: May 17 17:01:36 2020 GMT
* subjectAltName: host "developer.api.walmart.com" matched cert's "developer.api.walmart.com"
* issuer: C=BE; O=GlobalSign nv-sa; CN=GlobalSign Organization Validation CA - SHA256 - G2
* SSL certificate verify ok.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x56172ba6f6b0)
> GET /api-proxy/service/affil/product/v2/items HTTP/2
> Host: developer.api.walmart.com
> User-Agent: curl/7.58.0
> Accept-Encoding: deflate, gzip
> WM_CONSUMER.ID:X-removed-X
> WM_CONSUMER.INTIMESTAMP:1583698692666
> WM_SEC.KEY_VERSION:2
> WM_SEC.AUTH_SIGNATURE:IBVm1uz8+6uNA6XwJjweUjJRBHavUPCNoTXf6aino0uDN1DWFfSpaZRd+aVeoxdKZKZ2b/fC/gAcZoaBAqD4s6GaqO719d3E//EfLiRUPPB0AxKgpmB2/E6mlv5BPz3Zuds8aubPgruOaDJG8GjbLF4pxsV2AbLTgBV8/XSc2N7RSl/Sv4xyC2YIENRYn+Xclt7seScNq+5tlhvPtXTBCYQ02ocrJJ+TbOcMFNrIhQicQ6nLi/yIvPXjptPLLfYKrJI29AqWaHN1+mEdVK8NhqF8WEAPO897I7eVgTIw76A6XzKgwexf9irSRbjW88UbBsxMTS/xbvZNg51GYMl8YA==
> Accept:application/json
>
* Connection state changed (MAX_CONCURRENT_STREAMS updated)!
< HTTP/2 400
< accept-ranges: bytes
< content-encoding: gzip
< content-type: application/json;charset=utf-8
< last-modified: Sun, 08 Mar 2020 20:19:03 GMT
< strict-transport-security: max-age=86400
< x-lua-strict-transport-security: max-age=86400
< x-tb: 1
< x-tb-optimization-total-bytes-saved: 0
< wm_svc.env: prod
< wm_svc.name: affil-product
< wm_svc.version: 2.0.0
< date: Sun, 08 Mar 2020 20:19:03 GMT
< vary: Accept-Encoding
< set-cookie: TS01a35e2a=0130aff2324e25bae12799c8f4cf8c303c61b5b1e4b3a9b49b2dc40cd4190d5006c5aeff01fd85aab36fc6024d1cb0b15e79ae0780; Path=/; Secure
<
* Connection #0 to host developer.api.walmart.com left intact
{"errors":[{"code":4008,"message":"Missing itemId"}]}


日志:分类法

curl --verbose --compressed \
> -H "WM_CONSUMER.ID:X-removed-X" \
> -H "WM_CONSUMER.INTIMESTAMP:1583631173218" \
> -H "WM_SEC.KEY_VERSION:2" \
> -H "WM_SEC.AUTH_SIGNATURE:fJ0gfijP2k/Jp8L96xHmJvpHvhVohanxa7f+dzewuvh73jceaoEvpRTZfsybss4Sdn7Ytx7vk/l4k411tb1v6lLfIam8YhNW8niiO9MUxhdd7gjWDXhdsTTSnDrx4vy3eQtIetyz413APz1VZAKCViRJvqE4rh0JETMeY5vtEl6wgjyp1YgMol/t0+mz8y5n9wu4KlBVcE6D3yUxNNPGPzjKAVpxmQTsuw9Lp0awfLhArT74xXdfDUPGoJ72b09MVUtJ0pQsZoYY7WXybUgE2A6vtm80nqzQFEGVWVWoyfVtz0zPvaimQYklkLwUUrW8QimCFWCrpUDBwWVgPptKNQ==" \
> -H "Accept:application/json" \
> "https://developer.api.walmart.com/api-proxy/service/affil/product/taxonomy"
* Trying 104.90.152.88...
* TCP_NODELAY set
* Connected to developer.api.walmart.com (104.90.152.88) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: /etc/ssl/certs
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server accepted to use h2
* Server certificate:
* subject: C=US; ST=Arkansas; L=Bentonville; O=Wal-Mart Stores, Inc.; CN=prod.walmart.com
* start date: May 17 17:01:36 2019 GMT
* expire date: May 17 17:01:36 2020 GMT
* subjectAltName: host "developer.api.walmart.com" matched cert's "developer.api.walmart.com"
* issuer: C=BE; O=GlobalSign nv-sa; CN=GlobalSign Organization Validation CA - SHA256 - G2
* SSL certificate verify ok.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x557c4ef856b0)
> GET /api-proxy/service/affil/product/taxonomy HTTP/2
> Host: developer.api.walmart.com
> User-Agent: curl/7.58.0
> Accept-Encoding: deflate, gzip
> WM_CONSUMER.ID:X-removed-X
> WM_CONSUMER.INTIMESTAMP:1583631173218
> WM_SEC.KEY_VERSION:2
> WM_SEC.AUTH_SIGNATURE:fJ0gfijP2k/Jp8L96xHmJvpHvhVohanxa7f+dzewuvh73jceaoEvpRTZfsybss4Sdn7Ytx7vk/l4k411tb1v6lLfIam8YhNW8niiO9MUxhdd7gjWDXhdsTTSnDrx4vy3eQtIetyz413APz1VZAKCViRJvqE4rh0JETMeY5vtEl6wgjyp1YgMol/t0+mz8y5n9wu4KlBVcE6D3yUxNNPGPzjKAVpxmQTsuw9Lp0awfLhArT74xXdfDUPGoJ72b09MVUtJ0pQsZoYY7WXybUgE2A6vtm80nqzQFEGVWVWoyfVtz0zPvaimQYklkLwUUrW8QimCFWCrpUDBwWVgPptKNQ==
> Accept:application/json
>
* Connection state changed (MAX_CONCURRENT_STREAMS updated)!
< HTTP/2 403
< accept-ranges: bytes
< content-encoding: gzip
< content-type: application/json;charset=utf-8
< last-modified: Sun, 08 Mar 2020 20:20:57 GMT
< strict-transport-security: max-age=86400
< x-lua-strict-transport-security: max-age=86400
< x-tb: 1
< x-tb-optimization-total-bytes-saved: 0
< date: Sun, 08 Mar 2020 20:20:57 GMT
< vary: Accept-Encoding
< set-cookie: TS01a35e2a=0130aff232c50989262fcf9c5dfdc5de56262db0064892983ed98e2f5be77b65d62dcaa0db55c2386de3ea7190f7e3ff64099280bb; Path=/; Secure
<
* Connection #0 to host developer.api.walmart.com left intact
{"details":{"Description":"Unable to retrieve service related information, please read documentation for mandatory headers or URI specification"}}

最佳答案

在这个聊天室找到了解决方案: https://gitter.im/IO-support/community

文档不是最新的/令人困惑 -

  1. 您的第二个 URL 应该用于 API 的 V2 - 在本例中,https://developer.api.walmart.com/api-proxy/service/affil/product/v2/taxonomy

  2. 您的 第一个t URL 确实是 V2,但是输入参数的名称不同 - 查看 this page对于正确的输入 - 您应该传递强制性的 ids 参数。

关于walmart-api - Affiliate API 仅适用于 walmart.io "Try API"页面,但不适用于每个 curl 请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60608455/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com