Your Business Cockpit one REST call away. Online CRM / Invoicing integration / PDF Template
You never need to build your Customer Invoicing yourself again.
The SDK wraps the REST json schema API.
>>> pip install salesking
from salesking import resources
model = resources.get_model_class("contact")
data = {"organisation": "first customer via py api", "type": "Client"}
contact = model(data)
contact = contact.save()
from salesking import resources
model = resources.get_model_class("contact")
contact = model()
contact.organisation = "second customer"
contact.type = "Lead"
model = resources.get_model_class("address")
address = model()
address.city = u"Duisburg"
address.address1 = u"Foo Street"
address.address2 = u"Appartment Bar"
address.address_type = u"work"
contact.addresses = [address]
contact = contact.save()
print contact.get_data()
# collection properties you could find here
http://sk-api-browser.herokuapp.com/#contact click url params on the right
# Paging details:
# GET second page with 100 in list, only id+name
/contacts?per_page=100&page=2&fields=id,name
Example:
from salesking import collection
valid_filters = {u"organisation": u"salesking", u"type": u"Lead"}
col = collection.get_collection_instance("contact")
col.set_filters(valid_filters)
col.load()
items = col.get_items()
for x in items:
print u"id: %s name: %s" % (x.id, x.organisation)
col.reset_items()
col.load(page=2)
items = col.get_items()
for x in col.items:
print u"id: %s name: %s" % (x.id, x.organisation)
-
Register and activate a DEVELOPMENT USER at
-
Register Your app inside your salesking dev account
-
Take a look at the api
-
Browse the schema
-
create a local_settings.py in site-packages/salesking/.conf
-
edit your details in local_settings.py
-
have fun
#######################
-
create a fresh virtualenv
-
activate the virtualenv
-
run pip install -e .\salesking
-
configure your local_settings.py
-
run python -m unittest tests (logger silenced)
#Sidenotes: ###########
This SDK uses the automatic jsonschema validation of properties, in order to make it work, it removes porperties from the recieved data, that are containing None values, this means you have to wrap any data access in a try: except block...