NATS4 API Admin Get Adtools
From TMM Wiki
Jump to navigationJump to searchTo decode a nats code you must make a SOAP call with the following parameters:
<?xml version="1.0" encoding="ISO-8859-1"?> <SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="urn:natsapiadmin_wsdl"> <SOAP-ENV:Body> <tns:admin_get_adtools xmlns:tns="urn:natsapiadmin_wsdl"> <natscode xsi:type="xsd:string">MS4xLjEuMS4wLjEwLjAuMA</natscode> <siteid xsi:nil="true" xsi:type="xsd:int"/> <adtool_type_id xsi:type="xsd:int">2</adtool_type_id> <params xsi:type="xsd:string">a:2:{s:12:"searchinline";i:1;s:11:"search_type";s:3:"5:1";}</params> </tns:admin_get_adtools> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
You will get a response similar to:
<?xml version="1.0" encoding="ISO-8859-1"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="urn:natsapiadmin_wsdl"> <SOAP-ENV:Body> <ns1:admin_get_adtoolsResponse xmlns:ns1="urn:natsapiadmin_wsdl"> <return xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="tns:Adtool[4]"> <item xsi:type="tns:Adtool"> <adtoolid xsi:type="xsd:int">10</adtoolid> <name xsi:type="xsd:string">HATS</name> <url xsi:type="xsd:string">http://www.google.com/hats</url> <date_added xsi:type="xsd:int">1246909656</date_added> <published_date xsi:type="xsd:int">1246852800</published_date> <trackurl xsi:type="xsd:string">http://nats4.joe.dev.internal.toomuchmedia.com/gallery/MC4xLjEuMS4wLjEwLjAuMC4w</trackurl> <natscode xsi:type="xsd:string">MS4xLjEuMS4wLjEwLjAuMC4w</natscode> <extra xsi:type="xsd:string">a:13:{s:9:"networkid";s:1:"0";s:14:"adtool_type_id";s:1:"2";s:7:"deleted";s:1:"0";s:9:"byo_owner";s:1:"0";s:14:"byo_owner_only";s:1:"0";s:11:"byo_program";s:1:"0";s:4:"type";s:1:"1";s:5:"items";s:1:"0";s:11:"description";s:12:"Lots of hats";s:9:"thumbnail";s:0:"";s:9:"thumb_ext";s:0:"";s:10:"var_divide";s:1:"?";s:3:"ids";a:3:{s:7:"loginid";s:1:"1";s:9:"programid";s:1:"1";s:6:"siteid";s:1:"1";}}</extra> </item> <item xsi:type="tns:Adtool"> <adtoolid xsi:type="xsd:int">11</adtoolid> <name xsi:type="xsd:string">bags</name> <url xsi:type="xsd:string">http://www.google.com/bags</url> <date_added xsi:type="xsd:int">1246909656</date_added> <published_date xsi:type="xsd:int">1246852800</published_date> <trackurl xsi:type="xsd:string">http://nats4.joe.dev.internal.toomuchmedia.com/gallery/MC4xLjEuMS4wLjExLjAuMC4w</trackurl> <natscode xsi:type="xsd:string">MS4xLjEuMS4wLjExLjAuMC4w</natscode> <extra xsi:type="xsd:string">a:13:{s:9:"networkid";s:1:"0";s:14:"adtool_type_id";s:1:"2";s:7:"deleted";s:1:"0";s:9:"byo_owner";s:1:"0";s:14:"byo_owner_only";s:1:"0";s:11:"byo_program";s:1:"0";s:4:"type";s:1:"1";s:5:"items";s:1:"0";s:11:"description";s:12:"Lots of bags";s:9:"thumbnail";s:0:"";s:9:"thumb_ext";s:0:"";s:10:"var_divide";s:1:"?";s:3:"ids";a:3:{s:7:"loginid";s:1:"1";s:9:"programid";s:1:"1";s:6:"siteid";s:1:"1";}}</extra> </item> <item xsi:type="tns:Adtool"> <adtoolid xsi:type="xsd:int">12</adtoolid> <name xsi:type="xsd:string">gowns</name> <url xsi:type="xsd:string">http://www.google.com/gowns</url> <date_added xsi:type="xsd:int">1246909656</date_added> <published_date xsi:type="xsd:int">1246852800</published_date> <trackurl xsi:type="xsd:string">http://nats4.joe.dev.internal.toomuchmedia.com/gallery/MC4xLjEuMS4wLjEyLjAuMC4w</trackurl> <natscode xsi:type="xsd:string">MS4xLjEuMS4wLjEyLjAuMC4w</natscode> <extra xsi:type="xsd:string">a:13:{s:9:"networkid";s:1:"0";s:14:"adtool_type_id";s:1:"2";s:7:"deleted";s:1:"0";s:9:"byo_owner";s:1:"0";s:14:"byo_owner_only";s:1:"0";s:11:"byo_program";s:1:"0";s:4:"type";s:1:"1";s:5:"items";s:1:"0";s:11:"description";s:13:"Lots of gowns";s:9:"thumbnail";s:0:"";s:9:"thumb_ext";s:0:"";s:10:"var_divide";s:1:"?";s:3:"ids";a:3:{s:7:"loginid";s:1:"1";s:9:"programid";s:1:"1";s:6:"siteid";s:1:"1";}}</extra> </item> <item xsi:type="tns:Adtool"> <adtoolid xsi:type="xsd:int">13</adtoolid> <name xsi:type="xsd:string">shirts</name> <url xsi:type="xsd:string">http://www.google.com/shirts</url> <date_added xsi:type="xsd:int">1246909656</date_added> <published_date xsi:type="xsd:int">1246852800</published_date> <trackurl xsi:type="xsd:string">http://nats4.joe.dev.internal.toomuchmedia.com/gallery/MC4xLjEuMS4wLjEzLjAuMC4w</trackurl> <natscode xsi:type="xsd:string">MS4xLjEuMS4wLjEzLjAuMC4w</natscode> <extra xsi:type="xsd:string">a:13:{s:9:"networkid";s:1:"0";s:14:"adtool_type_id";s:1:"2";s:7:"deleted";s:1:"0";s:9:"byo_owner";s:1:"0";s:14:"byo_owner_only";s:1:"0";s:11:"byo_program";s:1:"0";s:4:"type";s:1:"1";s:5:"items";s:1:"0";s:11:"description";s:14:"Lots of shirts";s:9:"thumbnail";s:0:"";s:9:"thumb_ext";s:0:"";s:10:"var_divide";s:1:"?";s:3:"ids";a:3:{s:7:"loginid";s:1:"1";s:9:"programid";s:1:"1";s:6:"siteid";s:1:"1";}}</extra> </item> </return> </ns1:admin_get_adtoolsResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
NuSOAP Example (continuing from main article NuSOAP Example): <pre> style="margin: 0px; background: #ffffff; padding: 3px; border: 1px solid; width: 800px; height:800px; text-align: left; font-size: 120%; overflow: auto"> $values = array(
'natscode'=>'MS4xLjEuMS4wLjEwLjAuMA'
); $result = $client->call('decode_natscode', $values, 'natsapiadmin_wsdl'); var_dump($result); </pre> Output:
array(11) { ["loginid"]=> int(1) ["username"]=> string(13) "tmmnuph3fmaw4" ["programid"]=> int(1) ["siteid"]=> int(1) ["tourid"]=> int(1) ["campaignid"]=> int(0) ["adtoolid"]=> int(10) ["subid1"]=> int(0) ["subid2"]=> int(0) ["is_unencoded"]=> int(0) ["old_code"]=> string(1) "0" }