Api

From Online Business Wiki

(Redirected from API)
Jump to: navigation, search

Click on + to expand the category

Contents

Introduction

This system has an extensive API (application programmming interface) framework which you can use to communicate, synchronize, or undertake an action with your own external application. For example if you are an online shop and you want to adjust inventory levels in real-time as shoppers buy from you, then you can simply utilize this API. Other uses of the API include the ability to synchronize your entire customer database on this system with that located at your office. The API framework will in fact give you the freedom to undertake all sorts of tasks that are specific to the success of your business.


Basics

There are 2 API frameworks.

1) The Notification API

2) The Web Services API


Notification API

This is a simple framework that you can setup so this system pings your external application when certain events happen. Events include an online shop purchase, a request for quote via your online shop, a new customer enquiry via one of your web forms and so forth.

To enable this feature login to the Administration area and choose API Integration from the Admin menu (top-right). You will then need to enable the API Integration feature. Please allow up to 24 hours for this feature to be enabled. Once you have enabled this feature you can then enter a different URL, corresponding to a web page on your web server to handle the various events.

When any one of these events takes place the system will post to your web page. The system will post 2 variables called ObjectID and ObjectType.

ObjectID refers to the current internal ID assigned to the new enquiry or purchase. The ObjectType is not currently used, but refers to the type of action. E.g. A new case was created, a new order was created and so forth.

Please note that notifications process is asynchronous and can take up to 10 minutes before they arrive at your application.


The Web Services API

The web services API is an XML based framework that allows you to query the system and retrieve almost any type of data stored in your database. For example, using web services you can retrieve details about your customers, you can retrieve details for purchases including products purchased, payments received and their status. You can also undertake certain website actions. E.g. upload a new web page or retrieve a list of site-wide templates.

You can find more details here:

CRM Web Service

eCommerce-Related Web Service

Explanations of some of the methods and their parameters

Order_CreateUpdate

Here are some of the values for the <payments> section in the above method.

PaymentMethodType

  • CreditCard = 1
  • Cheque = 2
  • Cash = 3
  • EFT = 4
  • PayPal = 5
  • HostedCreditCard = 7 - like google checkout etc.
  • DirectDebit = 8
  • GiftVoucher = 9
  • Free = 10

PaymentStatusID

  • Unknown = -1
  • Succeeded = 0
  • Failed = 1
  • Pending = 2
  • Denied = 3


Sample Code

Sample Visual Studio 2005 project

Unless required by applicable law or agreed to in writing this sample code is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

Updating CRM Forms through API

If you are using one of the web services, such as ContactList_InsertUpdate, where you need to update a custom form through the API, you will find the following SOAP for those forms:

<crmForms>
  <CrmForms xsi:nil="true" />
  <CrmForms xsi:nil="true" />
</crmForms>

This is what that part of your file will actually look like:

<ns1:CrmForms> 
  <ns1:formId>8911111</ns1:formId> 
  <ns1:formName>Other Details</ns1:formName> 
    <ns1:crmFormFields> 
    <ns1:CrmFormFields> 
       <ns1:fieldId>89111</ns1:fieldId> 
       <ns1:fieldTypeId>1</ns1:fieldTypeId> 
       <ns1:fieldName>SendMailHome</ns1:fieldName> 
       <ns1:fieldValue>N</ns1:fieldValue> 
    </ns1:CrmFormFields> 
    <ns1:CrmFormFields> 
        <ns1:fieldId>89112</ns1:fieldId> 
        <ns1:fieldTypeId>1</ns1:fieldTypeId> 
        <ns1:fieldName>Admit_date</ns1:fieldName> 
        <ns1:fieldValue>2008/07/09</ns1:fieldValue> 
     </ns1:CrmFormFields> 
     <ns1:CrmFormFields> 
        <ns1:fieldId>89113</ns1:fieldId> 
        <ns1:fieldTypeId>1</ns1:fieldTypeId> 
        <ns1:fieldName>Join_date</ns1:fieldName> 
        <ns1:fieldValue>2007/10/11</ns1:fieldValue> 
     </ns1:CrmFormFields> 
     </ns1:crmFormFields> 
</ns1:CrmForms>

The best way to get the above format is to use one of the retrieval functions and you'll get the form IDs and the correct format.

However, if you don't want to do that, you can get all the values using Firebug. Here is how:

Go to Admin -> Extend Customer Database and you will see all the Custom forms. Move your mouse over the name of the custom form you are interested in and you will see the ID of that form in your browser's status bar. That's the value of <ns1:formId>8911111</ns1:formId> in the above example.

You then need to obtain the field IDs and you can do that by examining the fields with the Firebug. That will give you the <ns1:fieldId>89112</ns1:fieldId> ID.

Finally you have to get the field type for <ns1:fieldTypeId>1</ns1:fieldTypeId>. These are the field types and their values:

<option value="4">DateTime</option>
<option value="8">Image</option>
<option value="6">List (Checkbox List)</option>
<option value="5">List (Dropdown List)</option>
<option value="10">List (Listbox List)</option>
<option value="7">List (Radio List)</option>
<option value="2">Number</option>
<option value="11">Text (Hyperlink)</option>
<option value="9">Text (Multiline)</option>
<option value="1">Text (String)</option>
<option value="3">True/False (Boolean)</option>

Related Articles

Synchronizing external customer database using web services

Related Videos

Personal tools
Support Material