4

使用 CJ 的佣金详细信息服务 (REST) 的人能否告诉我此查询的示例 XML 响应是什么。

CJ 的 Web 服务文档都没有准确说明 XML 的格式,因为我没有任何佣金支付,但我只能猜测结果。

4

4 回答 4

3

通过注册我的一位出版商找到了艰难的方法:

<?xml version="1.0" encoding="UTF-8"?>
    <cj-api>
        <commissions total-matched="1">
            <commission>
                <action-status>
                    new
                </action-status>
                <action-type>
                    lead
                </action-type>
                <aid>
                    12345678
                </aid>
                <commission-id>
                    1234567890
                </commission-id>
                <country>
                </country>
                <event-date>
                    2010-05-08T08:08:55-0700
                </event-date>
                <locking-date>
                    2010-06-10
                </locking-date>
                <order-id>
                    123456
                </order-id>
                <original>
                    true
                </original>
                <original-action-id>
                    1234567890
                </original-action-id>
                <posting-date>
                    2010-05-08T10:01:22-0700
                </posting-date>
                <website-id>
                    1234567
                </website-id>
                <cid>
                    1234567
                </cid>
                <advertiser-name>
                    Merchant
                </advertiser-name>
                <commission-amount>
                    0
                </commission-amount>
                <order-discount>
                    0
                </order-discount>
                <sid>
                    0
                </sid>
                <sale-amount>
                    0
                </sale-amount>
            </commission>
        </commissions>
    </cj-api>
于 2010-05-09T21:21:48.467 回答
2

这是一个示例,它将读取上述示例 XML 报告中的每个节点。您可以提取所需的值并将它们保存到数据库中......微笑:)。

$cHTML='<?xml version="1.0" encoding="UTF-8"?>
    <cj-api>
        <commissions total-matched="1">
            <commission>
                <action-status>
                    new
                </action-status>
                <action-type>
                    lead
                </action-type>
                <aid>
                    12345678
                </aid>
                <commission-id>
                    1234567890
                </commission-id>
                <country>
                </country>
                <event-date>
                    2010-05-08T08:08:55-0700
                </event-date>
                <locking-date>
                    2010-06-10
                </locking-date>
                <order-id>
                    123456
                </order-id>
                <original>
                    true
                </original>
                <original-action-id>
                    1234567890
                </original-action-id>
                <posting-date>
                    2010-05-08T10:01:22-0700
                </posting-date>
                <website-id>
                    1234567
                </website-id>
                <cid>
                    1234567
                </cid>
                <advertiser-name>
                    Merchant
                </advertiser-name>
                <commission-amount>
                    0
                </commission-amount>
                <order-discount>
                    0
                </order-discount>
                <sid>
                    0
                </sid>
                <sale-amount>
                    0
                </sale-amount>
            </commission>
        </commissions>
    </cj-api>';
   echo  "i am here".$cHTML;
     $xml2=simplexml_load_string($cHTML);
      if ($xml2)
      {             $advertiserId='';
                    $orderno='';
                    $commission="";
                    $uid="";
                    $actiontype="";
                    $network="CommissionJunction";
                    foreach ($xml2->children() as $item) 
                            {
                             echo "ist".$item->getName()."<br>";

                             foreach ($item->children() as $node) 
                            {
                             echo "2nd".$node->getName()."<br>";
                                     foreach ($node->children() as $value) 
                                    {

                                     if ($value->getName()=='primary-category')///CATEGORIES
                                     {
                                     echo $value->getName().":".$value->parent.":".$value->child."<br>" ;
                                     //$vendorcategories=$value->parent;
                                     }
                                     elseif ($value->getName()=='actions')///COMMISION TERMS
                                     {
                                     echo $value->getName().":".$value->action->type."<br>" ;
                                     //$commissionon=$value->action->type;

                                     //echo $value->getName().":".$value->action->commission->default."<br>" ;
                                     //$commissioninfo=$value->action->commission->default;
                                     }elseif ($value->getName()=='advertiser-name')///ADVERTISER NAME
                                     {
                                     echo $value->getName().":".$value."<br>";
                                     //$vendor_name=$value;
                                     }elseif ($value->getName()=='program-url')///ADVERTISER NAME
                                     {
                                     echo $value->getName().":".$value."<br>" ;
                                     //$vendorurl=$value;
                                     }
                                      elseif ($value->getName()=='relationship-status')///ADVERTISER NAME
                                     {
                                     echo $value->getName().":".$value."<br>" ;
                                     //$approval=$value;
                                     }
                                     elseif ($value->getName()=='seven-day-epc')///ADVERTISER NAME
                                     {
                                     echo $value->getName().":".$value."<br>" ;
                                     //$epc_value=$value.",";
                                     }elseif ($value->getName()=='three-month-epc')///ADVERTISER NAME
                                     {
                                     echo $value->getName().":".$value."<br>" ;
                                     //$epc_value.=$value;

                                     }                                    
                                     else
                                     {
                                     echo "3rd".$value->getName().":".$value."<br>" ;

                                     }

                                    }

                            }
                              //echo $count;

                                //if($count>0)
                                //{
                                    //echo $item[$count];
                                //}
                                //$count = $count + 1;

                            }
于 2011-03-28T14:46:19.883 回答
1

以上所有答案现在都已过时。新的响应总共包含 20 个不同的项目。最近我在 CJ 上提出了一张票,这就是我得到的回应。在此处输入图像描述

我编写了一个用于轮询佣金详细服务 api 的 python 脚本。我通过获取第一个响应(佣金资源)的 original_action_id 并调用它的第二部分(项目详细资源)来涵盖佣金详细服务 api 的所有部分。最后,我将这两个 XML 合并到一个字典中。

https://github.com/arcticOak2/cj-commission-detail-service-api-complete-python-script

于 2018-03-26T21:08:40.777 回答
0

我刚刚使用 simplexml_load_string( $response ) 将其作为已回答的 xml 提要获取,但对象将如下所示:

SimpleXMLElement Object
(
    [commissions] => SimpleXMLElement Object
        (
            [@attributes] => Array
                (
                    [total-matched] => 1
                )

            [commission] => SimpleXMLElement Object
                (
                    [action-status] => new
                    [action-type] => lead
                    [aid] => 12345678
                    [commission-id] => 123456789
                    [country] => SimpleXMLElement Object
                        (
                        )

                    [event-date] => 2010-05-08T08:08:55-0700
                    [locking-date] => 2010-06-10
                    [order-id] => 123456
                    [original] => true
                    [original-action-id] => 123456789
                    [posting-date] => 2010-05-08T10:01:22-0700
                    [website-id] => 999999
                    [cid] => 123456
                    [advertiser-name] => Merchant
                    [commission-amount] => 0
                    [order-discount] => 0
                    [sid] => 0
                    [sale-amount] => 0
                )

        )

)
于 2011-01-05T17:03:00.397 回答