This shows you the differences between two versions of the page.
en:public:developer:template_system:tags:api:get_wwwfile_logs [2013/03/08 10:41] admin created |
en:public:developer:template_system:tags:api:get_wwwfile_logs [2013/03/09 18:21] (current) admin [Parameters] |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== <#get_wwwfile_logs> ====== | ====== <#get_wwwfile_logs> ====== | ||
- | Use this function to add a lead in the database. This function must be called only from | + | Use this function to retrieve the logs of a template file |
- | [[en:public:developer:template_system:cfgpages]]. The Lead will be connected to the current web | + | |
- | user (as the Buyer). The ID of the referrer (if any) of the lead will be extracted from the cookie | + | |
- | [[en:public:developer:template_system:reserved_parameters:ak__source]] | + | |
- | ==== CfgPages configuration ==== | + | |
- | <code xml> | + | ==== Parameters ==== |
- | <page name="My_Add_lead_Api_Function"> | + | |
- | <cfg> | + | |
- | <userrights> | + | |
- | <userright name="ALLUSER"/> | + | |
- | </userrights> | + | |
- | <frames> | + | |
- | <frame name="mainframe" processname="Add_lead" preload="1"/> | + | |
- | </frames> | + | |
- | </cfg> | + | |
- | </page> | + | |
- | </code> | + | |
- | ==== RESTFUL API ==== | + | Parameters are taken from tag (default) or from HTTP GET/Post |
- | The ArKadia API currently supports a [[http://en.wikipedia.org/wiki/REST|RESTful]] interface, that essentially | + | ^ Name ^ Mandatory ^ Default ^ Description ^ |
- | means you can send an HTTP GET or POST to call exposed methods, and you'll get back an XML document | + | | <html><span style="color:#008000">filename</span></html> | Yes | | the filename (related to the root). Ex: /templates/maintemplates/maintemplate.html | |
- | in return. | + | | <html><span style="color:#008000">output_format</span></html> | No | REST | **JSON** to retrieve response in [[en:public:developer:template_system:tags:api:JSON_Response_Format|JSON Format]] or **REST** to retrieve in [[en:public:developer:template_system:tags:api:REST_Response_Format|REST Format]] | |
+ | | <html><span style="color:#008000">jsoncallback</span></html> | No | | Callback function to use in [[en:public:developer:template_system:tags:api:JSON_Response_Format|JSON Response Format]] | | ||
- | When you call this function, you'll get a response in XML that looks like this: | + | ==== Error Codes ==== |
- | <code xml> | + | ^ Code ^ Description ^ |
- | <rsp stat="ok" version="1.0"> | + | | <html><span style="color:#008000">1</span></html> | Insufficient rights. You must be logged as an admin to see logs | |
- | [Data in XML format - see individual method docs] | + | | <html><span style="color:#008000">114</span></html> | File not found | |
- | </rsp> | + | |
- | </code> | + | |
- | If there's an error, you'll get a response with an error message about the problem. | ||
- | <code xml> | + | ==== Example ==== |
- | <rsp stat="fail"> | + | |
- | <error msg="Error Message" /> | + | |
- | <rsp> | + | |
- | </code> | + | |
- | ==== HTTP Get/Post Parameters ==== | + | <code html> |
- | ^ Name ^ Mandatory ^ Default ^ Description ^ | + | <#get_wwwfile_logs filename="/templates/maintemplates/maintemplate.html"> |
- | | <html><span style="color:#008000">Property.ID</span></html> | No | | ID of the property on with the lead will be linked | | + | |
- | | <html><span style="color:#008000">Lead.type</span></html> | Yes | | Type of lead (2=Web or 4=Telephone) | | + | |
- | ==== Error Codes ==== | + | </code> |
- | ^ Code ^ Description ^ | + | will output in **REST** |
- | | <html><span style="color:#008000">111</span></html> | One mandatory parameter is missing | | + | |
- | | <html><span style="color:#008000">119</span></html> | Wrong parameter values | | + | |
+ | <code xml> | ||
- | ==== Example ==== | + | <rsp stat="ok"> |
+ | <log> | ||
+ | <revision>7689</revision> | ||
+ | <author>nik</author> | ||
+ | <date>2/22/2013 1:10:45 PM</date> | ||
+ | </log> | ||
+ | <log> | ||
+ | <revision>7658</revision> | ||
+ | <author>www.arkadia.com</author> | ||
+ | <date>2/21/2013 9:07:25 AM</date> | ||
+ | </log> | ||
+ | </rsp> | ||
- | Ajax example on jQuery | + | </code> |
- | <code javascript> | + | And in **JSON** |
- | $.ajax({ | + | <code javascript> |
- | cache: false, | + | |
- | type: "GET", | + | |
- | data: { | + | |
- | Property.ID: 'CA-T1', | + | |
- | Lead.type: 2 | + | |
- | }, | + | |
- | url: '<#url id="/api/add_lead/">', | + | |
- | dataType: "xml", | + | |
- | success: callbackfunction_on_success, | + | |
- | error: function (jqXHR, textStatus, errorThrown) {} | + | |
- | }); | + | |
- | function callbackfunction_on_success (response) { | + | { |
- | var $root = $('rsp',response); | + | "stat":"ok", |
- | if ($root.attr('stat') == 'ok'){ | + | "logs":[ |
- | var leadid = $root.find('id').Html(); | + | { |
+ | "revision":"7689", | ||
+ | "author":"nik", | ||
+ | "date":"2/22/2013 1:10:45 PM" | ||
+ | }, | ||
+ | { | ||
+ | "revision":"7658", | ||
+ | "author":"www.arkadia.com", | ||
+ | "date":"2/21/2013 9:07:25 AM" | ||
+ | } | ||
+ | ] | ||
} | } | ||
- | } | ||
</code> | </code> |