Skip to content
frankwiles edited this page Mar 1, 2013 · 72 revisions

Introduction

Welcome! This is the wiki for the Sugarcrm python wrapper class. The following will be a brief introduction to what the sugarCRM API is, what python is and an explaination of the intricate functionalities of how everything works. This wiki will hopefully guide you through the steps of how each part of the python class and how it interacts with the server, as well as giving detailed demonstration through various examples.


What is python?

Python is an interpreted and high-level programming language with an emphasis on readability. Python also uses multiple programming paradigms such as object-orientated, imperative and functional programming styles. Python is also a dynamic language, which makes it a powerful language to use when dealing with internet based functionalities. This language easily allows us to work more quickly and integrate our systems more effectively. You can learn to use Python and see almost immediate gains in productivity and lower maintenance costs.

Learning how to use python


What is the Sugarcrm API?

Sugarcrm is an API that is both an open-source and a propriety based web application used for company relationship management. This is a user friendly API for the SugarCRM API class in Python language. SugarCRM provides an application programming interface, Sugar Web Services API, to enable you to customize and extend your Sugar application. This specific version of the API uses a python wrapper class to interface with the sugarcrm server and removes a lot of redundancy and confusion from the user. By doing so, it allows us to create a much more readable way of letting the user perform the same functionality but with an increased ease of use.


Initializing a SugarCRM object

Python uses __init__() to define new instances of an object. It is used to create a new object for a sugarcrm session. The definition itself takes the website url, your user name and your password to create an object that you can use to call the API functions. This initialization handles the login functionality as well, by taking this variables and passing it to the login function when the object is created. Assuming that all three variables are correct, the user will be able to receive confirmation that they have successfully logged into the server.

Initializing a SugarCRM Object


###SugarCRM Server

There are also some functions in the sugarCRM API that deal with the server itself. In this section we will discuss how you log into the sugarCRM server, logout of the server and how to get general information in regards to the server itself.

SugarCRM Server


Manipulating modules

Modules are a type in a database which is used to organize information based on this specific type. For example, you would store all the user names in the 'Name' module or storing all account names in the 'Account' module. Therefore, we need ways of accessing specific modules. The following will explain what functions the sugarCRM API has to manipulate, view, and access these modules.

Manipulating Modules


###Manipulating Entries

The database stores all of its information using entries, which are contained inside each field of a module. SugarCRM calls their entries sugarbeans. Much like the modules, the API has numerous methods of adding, changing, deleting and viewing entries of the database.

Manipulating Entries


###Manipulating Relationships

The database uses relationships as a means of linking entries together. Say you want to find out how to get fields that go together, but those two fields exist in different modules. Linking the fields isn't as simple as just finding all the ones that match a given name. For that you need to be able to use relationships. Relationships help us link modules and entries together that contain the same information. Relationships help link all the modules together that fields are related to so we can view and modify entries quickly and easily.

Manipulating Relationships


###Unit Testing

Unit testing is the ability to test single units of code. The sugarcrm API has built in unit functions that you can call to test individual functions. This page will help explain and guide you on how to use the sugarcrm's unit testing capabilities.

Unit Testing


###API Functions Tutorial

  1. SugarCRM API Documentation - definitions and tutorial from every functions of the SugarCRM API.
  2. SugarCRM Class
  3. SugarBean Class
  4. SugarEntrylist Class
  5. SugarError Class
  6. SugarModule Class
  7. Functions UnitTest - API Function Unittests.
  8. Examples

###Installation

These are the step-by-step to installing and running the sugarcrm api class in python. Make sure to install python 2.6 or later before this.

###Step 1:

To obtain the sugarcrm, 'cd' to a directory where you want it, then:

git clone https://<GIT_USERNAME>@github.com/sugarcrm/python_webservices_library.git

This will create a copy of the sugarcrm python folder.

###Step 2:

Run setup.py to install sugarcrm class.

python setup.py

###Step 3:

To use the sugarcrm python class, simply import sugarcrm at the begin of your python program.

import sugarcrm