【问题标题】:How to pass XML array into Shopify API call如何将 XML 数组传递给 Shopify API 调用
【发布时间】:2012-11-02 11:16:07
【问题描述】:
<?xml version="1.0" encoding="UTF-8"?>
<product>
   <id type="integer">100159400</id>
<title>150 Watt Mini Stereo Power Amplifier</title>
<variants type="array">
<variant>
<id type="integer">233139732</id>
<grams type="integer">700</grams>
<inventory-quantity type="integer">222</inventory-quantity>
 </variant>
</variants>
</product>

它对我不起作用。我在 shopify api 调用中解析 xml 数组

$recurring_application_charge = $shopify('PUT', '/admin/products/109720638.xml', $product);

这里我正在解析单个值,但我需要传递在 shopify 商店中插入记录后存储在数据库中的动态值。对于单个产品,即使更新命令也不适用于我。请帮帮我,

【问题讨论】:

  • 您使用的是库还是原始 HTTP 请求?确保设置了 Content-Type 标头(例如 text/xml)。也请告诉我们您收到的回复。

标签: php api shopify


【解决方案1】:

如果您使用的是 Sandeep 的 PHP 适配器,您必须将 (Shopify.php) 中的内容类型更改为 XML。默认情况下,适配器使用 Json 格式来 POST 请求。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-04-10
    相关资源
    最近更新 更多