User Tools

Site Tools


en:public:developer:template_system:tags:api:add_lead

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

en:public:developer:template_system:tags:api:add_lead [2013/01/14 13:51]
admin [HTTP Get/Post Parameters]
en:public:developer:template_system:tags:api:add_lead [2013/03/30 18:08] (current)
svanderclock [CfgPages configuration]
Line 2: Line 2:
  
 Use this function to add a lead in the database. This function must be called only from  Use this function to add a lead in the database. This function must be called only from 
-[[en:public:developer:template_system:cfgpages]] +[[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 ==== ==== CfgPages configuration ====
  
 <code xml> <code xml>
-  <page name="My_Add_lead_Api_Function"> +<page name="add_lead"> 
-    <cfg> +  <cfg> 
-      <userrights> +    <userrights> 
- <userright name="ALLUSER"/> +      <userright name="ALLUSER"/> 
-      </userrights> +    </userrights> 
-      <frames> +    <frames> 
- <frame name="mainframe" processname="Add_leadpreload=&quot;1&quot;/> +      <frame name="content" processname="add_lead"/&gt; 
-      </frames+    &lt;/frames
-    </cfg+    <maintemplate>maintemplates\maintemplate_empty.html</maintemplate
-  </page>+    <content_type>&lt;#content_type&gt;</content_type
 +  </cfg> 
 +</page>
 </code> </code>
  
-==== RESTful API ====+==== Parameters ====
  
-The ArKadia API currently supports a [[http://en.wikipedia.org/wiki/REST|RESTful]] interface, that essentially  +Parameters are taken from tag (default) or from HTTP GET/Post
-means you can send an HTTP GET or POST to call exposed methods, and you'll get back an XML document  +
-in return. +
- +
-When you call this function, you'll get a response in XML that looks like this: +
- +
-<code xml> +
-<rsp stat="ok" version="1.0"> +
-  [Data in XML format - see individual method docs] +
-</rsp> +
-</code> +
- +
-If there's an error, you'll get a response with an error message about the problem. +
- +
-<code xml> +
-<rsp stat="fail"> +
-  <error msg="Error Message" /> +
-<rsp> +
-</code> +
- +
-==== HTTP Get/Post Parameters ====+
  
 ^ Name                                                        ^ Mandatory ^ Default             ^ Description       ^        ^ Name                                                        ^ Mandatory ^ Default             ^ Description       ^       
 | <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">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 (1=Email ; 2=Web ; 3=Alerte ; 4=Telephone) |+| <html><span style="color:#008000">Lead.type</span></html>   | Yes       |                     | Type of lead (2=Web or 4=Telephone) |
  
 ==== Error Codes ==== ==== Error Codes ====
Line 51: Line 34:
 ^ Code                                                ^ Description ^        ^ Code                                                ^ Description ^       
 | <html><span style="color:#008000">111</span></html> | One mandatory parameter is missing | | <html><span style="color:#008000">111</span></html> | One mandatory parameter is missing |
 +| <html><span style="color:#008000">119</span></html> | Wrong parameter values |
  
  
 ==== Example ==== ==== Example ====
  
-<code>+Ajax example on jQuery 
 + 
 +<code javascript>
 + 
 +$.ajax({ 
 +    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);
 +  if ($root.attr('stat') == 'ok'){
 +    var leadid = $root.find('id').Html();
 +  }
 +}
  
 </code> </code>
en/public/developer/template_system/tags/api/add_lead.1358157113.txt.gz · Last modified: 2013/01/14 13:51 by admin