freelancersunion/django-salesforce — pull request #57 by hynekcer (2014-05-31 17:20:49+00:00)
Title: Tooling API and Metadata API

Implemented Tooling API: creating Apex classes, running Apex, reading ApexLog.

Example: Enable logging 5 minutes with minimalistic levels and run Hello World.

$ python manage.py shell
>>> from salesforce.tooling import *
>>> user_id = sf_get('')['identity'].split('/')[-1]
>>> set_trace_flag(user_id, user_id, level='Debug', ApexProfiling='Warn', System='Warn')
>>> result, log_info, log_body = execute_anonymous_logged("System.debug('Hello'+' World');")
>>> assert 'Hello World' in log_body

More examples in docs strings after ">>>".

---

Implemented a simple Metadata API with demo that creates a 'Test__c' object.

$ python manage.py shell
>>> from salesforce.tooling import *
>>> install_metadata_service()
>>> create_demo_test_object()

The function 'install_metadata_service' installls a 750 kB class
'MetadataService' from Github to SF. This implementation requires enabled
callouts from your SF site to itself. You will be informed how to do it,
if it fails.

----

I expect merge into a new branch and discussion about it until it will be really used. It is currently only a nice tool more useful for me than the Developer Console.