@@ -296,6 +296,35 @@ lead = mc.execute(method='get_lead_changes', fields=['firstName','lastName'], ne
296296# this will potentially return a lot of records: the function loops until it has all activities, then returns them
297297```
298298
299+ Add Custom Activities
300+ ---------------------
301+ API Ref: http://developers.marketo.com/documentation/rest/add-custom-activities/
302+ ``` python
303+ custom_activities = [
304+ {
305+ " leadId" : 46 ,
306+ " activityDate" : " 2016-03-05T09:51:00-08:00" ,
307+ " activityTypeId" : 100004 ,
308+ " primaryAttributeValue" :" Blue" ,
309+ " attributes" :[
310+ {
311+ " name" : " Attribute 1" ,
312+ " value" : " First Attribute"
313+ },
314+ {
315+ " name" : " Attribute 2" ,
316+ " value" : " Second Attribute"
317+ }
318+ ]
319+ }
320+ ]
321+ result = mc.execute(method = ' add_custom_activities' , input = custom_activities)
322+
323+ # Currently, Custom Activities need to be set up by Marketo Technical Support or Consulting Services
324+ # max batch size is 300
325+ ```
326+
327+
299328Get Daily Usage
300329---------------
301330API Ref: http://developers.marketo.com/documentation/rest/get-daily-usage/
@@ -771,6 +800,130 @@ file = mc.execute(method='update_file_content', id=23307, file='Marketo-Logo-Lar
771800# in 'file', specify a path if file is not in the same folder as the Python script
772801```
773802
803+ Snippets
804+ ========
805+
806+ Create Snippet
807+ --------------
808+ API Ref: http://developers.marketo.com/documentation/asset-api/create-snippet/
809+ ``` python
810+ snippet = mc.execute(method = ' create_snippet' , folderId = 132 , folderType = " Folder" , name = " API Snippet" , description = None )
811+
812+ # description is optional
813+ ```
814+
815+ Get Snippet By Id
816+ -----------------
817+ API Ref: http://developers.marketo.com/documentation/asset-api/get-snippet-by-id/
818+ ``` python
819+ snippet = mc.execute(method = ' get_snippet_by_id' , id = 9 )
820+ ```
821+
822+ Delete Snippet
823+ --------------
824+ API Ref: http://developers.marketo.com/documentation/asset-api/delete-snippet-by-id/
825+ ``` python
826+ snippet = mc.execute(method = ' delete_snippet' , id = 9 )
827+ ```
828+
829+ Update Snippet
830+ --------------
831+ API Ref: http://developers.marketo.com/documentation/asset-api/update-snippet/
832+ ``` python
833+ snippet = mc.execute(method = ' update_snippet' , id = 9 , name = " API Snippet 2" , description = ' Hello New Description' )
834+ ```
835+
836+ Get Snippets
837+ ------------
838+ API Ref: http://developers.marketo.com/documentation/asset-api/update-snippet/
839+ ``` python
840+ snippets = mc.execute(method = ' get_snippets' , maxReturn = None )
841+
842+ # maxReturn is optional
843+ ```
844+
845+ Get Snippet Content
846+ -------------------
847+ API Ref: http://developers.marketo.com/documentation/asset-api/get-snippet-content-by-id/
848+ ``` python
849+ snippet = mc.execute(method = ' get_snippet_content' , id = 9 )
850+ ```
851+
852+ Update Snippet Content
853+ ----------------------
854+ API Ref: http://developers.marketo.com/documentation/asset-api/update-snippet-content-by-id/
855+ ``` python
856+ html_content = ' <html><head></head><body><p>Hello World</p></body></html>'
857+ snippet = mc.execute(method = ' update_snippet_content' , id = 9 , type = ' HTML' , content = html_content)
858+ ```
859+
860+ Approve Snippet
861+ ---------------
862+ API Ref: http://developers.marketo.com/documentation/asset-api/approve-snippet-by-id/
863+ ``` python
864+ snippet = mc.execute(method = ' approve_snippet' , id = 9 )
865+ ```
866+
867+ Unapprove Snippet
868+ -------------------
869+ API Ref: http://developers.marketo.com/documentation/asset-api/unapprove-snippet-by-id/
870+ ``` python
871+ snippet = mc.execute(method = ' unapprove_snippet' , id = 9 )
872+ ```
873+
874+ Discard Snippet Draft
875+ ---------------------
876+ API Ref: http://developers.marketo.com/documentation/asset-api/discard-snippet-draft-by-id/
877+ ``` python
878+ snippet = mc.execute(method = ' discard_snippet_draft' , id = 9 )
879+ ```
880+
881+ Clone Snippet
882+ --------------
883+ API Ref: http://developers.marketo.com/documentation/asset-api/clone-snippet/
884+ ``` python
885+ snippet = mc.execute(method = ' clone_snippet' , id = 9 , name = ' Cloned Snippet' , folderId = 132 , folderType = ' Folder' ,
886+ description = None )
887+
888+ # description is optional
889+ ```
890+
891+ Update Snippet Dynamic Content
892+ -------------------
893+ API Ref: http://developers.marketo.com/documentation/asset-api/update-snippet-dynamic-content-by-id/
894+ ``` python
895+ snippet = mc.execute(method = ' update_snippet_dynamic_content' , id = 9 , segmentId = 1008 ,
896+ value = ' <p>Text in Dutch</p>' , type = ' HTML' )
897+ ```
898+
899+ Get Snippet Dynamic Content
900+ -------------------
901+ API Ref: http://developers.marketo.com/documentation/asset-api/get-snippet-dynamic-content-by-id/
902+ ``` python
903+ snippet = mc.execute(method = ' get_snippet_dynamic_content' , id = 9 )
904+ ```
905+
906+ Segmentations
907+ =============
908+
909+ Get Segmentations
910+ -----------------
911+ API Ref: http://developers.marketo.com/documentation/asset-api/get-segmentation-by-id/
912+ ``` python
913+ segmentations = mc.execute(method = ' get_segmentations' , status = ' approved' )
914+
915+ # status is optional; values are 'draft' or 'approved'
916+ ```
917+
918+ Get Segments
919+ -----------------
920+ API Ref: http://developers.marketo.com/documentation/asset-api/get-segments/
921+ ``` python
922+ segments = mc.execute(method = ' get_segments' , id = 1001 , status = None )
923+
924+ # status is optional; values are 'draft' or 'approved'
925+ ```
926+
774927
775928Landing Page Templates
776929===============
@@ -1260,13 +1413,6 @@ result = mc.execute(method='get_sales_persons', filterType='externalSalesPersonI
12601413```
12611414
12621415
1263- TODO
1264- ====
1265- * Implement Snippet APIs
1266- * Implement Custom Activity API: http://developers.marketo.com/documentation/rest/add-custom-activities/
1267- * find alternative for mode='nojsondumps'
1268-
1269-
12701416Programming Conventions
12711417=======================
12721418Conventions used for functions:
0 commit comments