佣金详情服务(REST)

发布于 2024-08-31 10:18:30 字数 112 浏览 4 评论 0原文

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

CJ 的 Web 服务文档都没有准确说明 XML 的格式,而且由于我没有任何佣金,所以我只能猜测结果。

Can someone who uses CJ's Commission Detail Service (REST) tell me what a sample XML response is for this query.

None of CJ's Web Services documentation indicates exactly how the XML is formatted and as I don't have any commission payments yet I can only guess the result.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

泪痕残 2024-09-07 10:18:31

通过与我的出版商之一签约,我发现了一个艰难的方法:

<?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>

Found out the hard way by signing up to one of my publishers :

<?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>
暖风昔人 2024-09-07 10:18:31

这是一个示例,它将读取上述示例 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;

                            }

THis is an example which will read each node in the your above sample XML report. you can extract the required values and save them into the DB...... smiles :).

$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;

                            }
Smile简单爱 2024-09-07 10:18:31

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

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

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

All the above answers are now outdated. The new response contains the total of 20 different items. Recently I've raised a ticket on CJ and this is the response I got.enter image description here

I have written one python script for polling commission detail service api. I have covered all parts of commission detail service api by fetching original_action_id of the first response(Commissions Resource) and calling the 2nd part of it(Item-Detail Resource). Finally I'm merging both those XML into a single dictionary.

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

温柔戏命师 2024-09-07 10:18:31

我只是使用 simplexml_load_string( $response ) 将其作为已经回答的 xml feed 获取,但该对象将显示如下:

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
                )

        )

)

I just used simplexml_load_string( $response ) to get it as xml feed as already answered but the object would appear as follows:

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
                )

        )

)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文