where customization begins: an intro to the salsa api and salsascript
DESCRIPTION
Where Customization Begins: An Intro to the Salsa API and Salsascript -- presentation by Salsa's Silona and Yonathan for the 2011 Salsa Community Conference.TRANSCRIPT
![Page 1: Where Customization Begins: An Intro to the Salsa API and Salsascript](https://reader034.vdocuments.us/reader034/viewer/2022042700/554ed772b4c905d1158b474f/html5/thumbnails/1.jpg)
www.salsalabs.com
![Page 2: Where Customization Begins: An Intro to the Salsa API and Salsascript](https://reader034.vdocuments.us/reader034/viewer/2022042700/554ed772b4c905d1158b474f/html5/thumbnails/2.jpg)
www.salsalabs.com
Where Customization Begins!
An Intro to the Salsa API and SalsaScript
![Page 3: Where Customization Begins: An Intro to the Salsa API and Salsascript](https://reader034.vdocuments.us/reader034/viewer/2022042700/554ed772b4c905d1158b474f/html5/thumbnails/3.jpg)
www.salsalabs.com
Yon and Silona Silona and Yon
Yon - senior programmer - [email protected] - developer community manager - [email protected]
![Page 4: Where Customization Begins: An Intro to the Salsa API and Salsascript](https://reader034.vdocuments.us/reader034/viewer/2022042700/554ed772b4c905d1158b474f/html5/thumbnails/4.jpg)
www.salsalabs.com
1. Form Actions2. RESTful API
3. SalsaScript based API
SalsaAPI basics
![Page 5: Where Customization Begins: An Intro to the Salsa API and Salsascript](https://reader034.vdocuments.us/reader034/viewer/2022042700/554ed772b4c905d1158b474f/html5/thumbnails/5.jpg)
www.salsalabs.com
easy peasy
Form Based Actions
![Page 6: Where Customization Begins: An Intro to the Salsa API and Salsascript](https://reader034.vdocuments.us/reader034/viewer/2022042700/554ed772b4c905d1158b474f/html5/thumbnails/6.jpg)
www.salsalabs.com
https://secure.flickr.com/photos/doolloop/110837794/
![Page 7: Where Customization Begins: An Intro to the Salsa API and Salsascript](https://reader034.vdocuments.us/reader034/viewer/2022042700/554ed772b4c905d1158b474f/html5/thumbnails/7.jpg)
www.salsalabs.com
Simple Signup Box for emailGather more infoPetitionsSurveysActionsEvent
You can get setup in minutes!
![Page 8: Where Customization Begins: An Intro to the Salsa API and Salsascript](https://reader034.vdocuments.us/reader034/viewer/2022042700/554ed772b4c905d1158b474f/html5/thumbnails/8.jpg)
www.salsalabs.com
Create the Page in Salsa HQ Add various options you will need -- add supporter to a group, send email trigger(s) upon sign-up, redirect info, etc.
Step 1
![Page 9: Where Customization Begins: An Intro to the Salsa API and Salsascript](https://reader034.vdocuments.us/reader034/viewer/2022042700/554ed772b4c905d1158b474f/html5/thumbnails/9.jpg)
www.salsalabs.com
Cut and Paste! Click on the link generated in HQ to view the
page, then cut & paste relevant section (everything between <form> ... </form>) to your hosted site.
Step 2
![Page 10: Where Customization Begins: An Intro to the Salsa API and Salsascript](https://reader034.vdocuments.us/reader034/viewer/2022042700/554ed772b4c905d1158b474f/html5/thumbnails/10.jpg)
www.salsalabs.com
Fix the relative path Change the relative path in the form action
to an absolute path pointing to your node location
<form name="data" action="/save" method="POST">to<form name="data" action="http://hq-salsa.
democracyinaction.org/save" method="POST">
Step 3
![Page 11: Where Customization Begins: An Intro to the Salsa API and Salsascript](https://reader034.vdocuments.us/reader034/viewer/2022042700/554ed772b4c905d1158b474f/html5/thumbnails/11.jpg)
www.salsalabs.com
Set up Error messages add the following anywhere on you page.<script type="text/javascript" src="http://yournode/api/flashMessageJS.sjs"></script>e.g.<script type="text/javascript" src="http://hq-salsa.democracyinaction.org/api/flashMessageJS.sjs"></script>
Step 4
![Page 12: Where Customization Begins: An Intro to the Salsa API and Salsascript](https://reader034.vdocuments.us/reader034/viewer/2022042700/554ed772b4c905d1158b474f/html5/thumbnails/12.jpg)
www.salsalabs.com
TA DA!
https://secure.flickr.com/photos/cc_chapman/4878364959/
![Page 13: Where Customization Begins: An Intro to the Salsa API and Salsascript](https://reader034.vdocuments.us/reader034/viewer/2022042700/554ed772b4c905d1158b474f/html5/thumbnails/13.jpg)
www.salsalabs.com
What is a NPO without Supporters? and ways to encourage them to sign up more?
![Page 14: Where Customization Begins: An Intro to the Salsa API and Salsascript](https://reader034.vdocuments.us/reader034/viewer/2022042700/554ed772b4c905d1158b474f/html5/thumbnails/14.jpg)
www.salsalabs.com
Petitions Surveys Email lists Events Actions
in minutes!
You can create
![Page 15: Where Customization Begins: An Intro to the Salsa API and Salsascript](https://reader034.vdocuments.us/reader034/viewer/2022042700/554ed772b4c905d1158b474f/html5/thumbnails/15.jpg)
www.salsalabs.com
● http://www.salsalabs.com/devs● http://www.salsalabs.
com/devs/recipes/webform_api/signup_form
● http://www.salsalabs.com/p/salsa/website/public2/commons/dev/docs/api/unauthenticated.sjs?null
● http://www.salsalabs.com/devs/recipes/webform_api/action_form
● http://www.salsalabs.com/devs/recipes/webform_api/event_form
Additional resources
![Page 16: Where Customization Begins: An Intro to the Salsa API and Salsascript](https://reader034.vdocuments.us/reader034/viewer/2022042700/554ed772b4c905d1158b474f/html5/thumbnails/16.jpg)
www.salsalabs.com
RESTful API
![Page 17: Where Customization Begins: An Intro to the Salsa API and Salsascript](https://reader034.vdocuments.us/reader034/viewer/2022042700/554ed772b4c905d1158b474f/html5/thumbnails/17.jpg)
www.salsalabs.com
What is REST?
representational state transfer
![Page 18: Where Customization Begins: An Intro to the Salsa API and Salsascript](https://reader034.vdocuments.us/reader034/viewer/2022042700/554ed772b4c905d1158b474f/html5/thumbnails/18.jpg)
www.salsalabs.com
https://secure.flickr.com/photos/becca/9541595/
![Page 19: Where Customization Begins: An Intro to the Salsa API and Salsascript](https://reader034.vdocuments.us/reader034/viewer/2022042700/554ed772b4c905d1158b474f/html5/thumbnails/19.jpg)
www.salsalabs.com
http://tomayko.com/writings/rest-to-my-wife
Get Put Delete an objectCRUD Create, Read, Update and Delete
● Current API - getObject or getObjects
○ Powerful but obtuse
● RESTful API - more specific○ getSupporter○ getEvent○ getDonation
No Really... What is REST
![Page 20: Where Customization Begins: An Intro to the Salsa API and Salsascript](https://reader034.vdocuments.us/reader034/viewer/2022042700/554ed772b4c905d1158b474f/html5/thumbnails/20.jpg)
www.salsalabs.com
MongoDB - NoSQL● Integrations
● Mashery ● 150K dev
● easy dev - check box like salesforce● hire more devs but for free
● Drupal ● Large scale CMS
● Wordpress ● 22% of the websites
Why REST?
![Page 21: Where Customization Begins: An Intro to the Salsa API and Salsascript](https://reader034.vdocuments.us/reader034/viewer/2022042700/554ed772b4c905d1158b474f/html5/thumbnails/21.jpg)
www.salsalabs.com
Authentication
● http://hq-salsa.democracyinaction.org/api/authenticate.sjs?email=youremailaddress&password=yourpassword
Primary use cases are for syncing data across desparate databases.
![Page 22: Where Customization Begins: An Intro to the Salsa API and Salsascript](https://reader034.vdocuments.us/reader034/viewer/2022042700/554ed772b4c905d1158b474f/html5/thumbnails/22.jpg)
www.salsalabs.com
![Page 23: Where Customization Begins: An Intro to the Salsa API and Salsascript](https://reader034.vdocuments.us/reader034/viewer/2022042700/554ed772b4c905d1158b474f/html5/thumbnails/23.jpg)
www.salsalabs.com
Getting data:-- xmlhttp://hq-salsa.democracyinaction.org/api/getObject.sjs?xml&object=supporter&key=thesupporter_KEY -- jsonhttp://hq-salsa.democracyinaction.org/api/getObject.sjs?json&object=supporter&key=thesupporter_KEY
getObject.sjs
![Page 24: Where Customization Begins: An Intro to the Salsa API and Salsascript](https://reader034.vdocuments.us/reader034/viewer/2022042700/554ed772b4c905d1158b474f/html5/thumbnails/24.jpg)
www.salsalabs.com
![Page 25: Where Customization Begins: An Intro to the Salsa API and Salsascript](https://reader034.vdocuments.us/reader034/viewer/2022042700/554ed772b4c905d1158b474f/html5/thumbnails/25.jpg)
www.salsalabs.com
![Page 26: Where Customization Begins: An Intro to the Salsa API and Salsascript](https://reader034.vdocuments.us/reader034/viewer/2022042700/554ed772b4c905d1158b474f/html5/thumbnails/26.jpg)
www.salsalabs.com
http://hq-salsa.democracyinaction.org/api/getObjects.sjs?xml&object=supporter&include=First_Name,Last_Name,Email&condition=supporter_KEY=condition● Note how you can add an include parameter, you can toggle the out
put by changing xml to json● Condition can be anything that you would put in the where part of a sql
query
getObjects.sjs
![Page 27: Where Customization Begins: An Intro to the Salsa API and Salsascript](https://reader034.vdocuments.us/reader034/viewer/2022042700/554ed772b4c905d1158b474f/html5/thumbnails/27.jpg)
www.salsalabs.com
![Page 28: Where Customization Begins: An Intro to the Salsa API and Salsascript](https://reader034.vdocuments.us/reader034/viewer/2022042700/554ed772b4c905d1158b474f/html5/thumbnails/28.jpg)
www.salsalabs.com
● http://hq-salsa.democracyinaction.org/api/getLeftJoin.sjs?xml&object=supporter_groups,supporter&condition=supporter_KEY=thesupporter_KEY&include=groups_KEY
getLeftJoin.sjs
![Page 29: Where Customization Begins: An Intro to the Salsa API and Salsascript](https://reader034.vdocuments.us/reader034/viewer/2022042700/554ed772b4c905d1158b474f/html5/thumbnails/29.jpg)
www.salsalabs.com
![Page 30: Where Customization Begins: An Intro to the Salsa API and Salsascript](https://reader034.vdocuments.us/reader034/viewer/2022042700/554ed772b4c905d1158b474f/html5/thumbnails/30.jpg)
www.salsalabs.com
● http://hq-salsa.democracyinaction.org/api/getCounts.sjs?object=donation&condition=RESULT=0&countColumn=amount&xml&callback
● http://hq-salsa.democracyinaction.org/api/getCounts.sjs?object=donation&condition=RESULT=0&countColumn=amount&json&callback
getCounts.sjs
![Page 31: Where Customization Begins: An Intro to the Salsa API and Salsascript](https://reader034.vdocuments.us/reader034/viewer/2022042700/554ed772b4c905d1158b474f/html5/thumbnails/31.jpg)
www.salsalabs.com
![Page 32: Where Customization Begins: An Intro to the Salsa API and Salsascript](https://reader034.vdocuments.us/reader034/viewer/2022042700/554ed772b4c905d1158b474f/html5/thumbnails/32.jpg)
www.salsalabs.com
![Page 33: Where Customization Begins: An Intro to the Salsa API and Salsascript](https://reader034.vdocuments.us/reader034/viewer/2022042700/554ed772b4c905d1158b474f/html5/thumbnails/33.jpg)
www.salsalabs.com
Adding datahttps://hq-salsa.democracyinaction.org/save?xml&object=supporter&organization_KEY=yourorgKEY&key=thesupporter_KEY&City=myCity&First_Name=Yoncheck:http://hq-salsa.democracyinaction.org/api/getObjects.sjs?xml&object=supporter&include=First_Name,Last_Name,Email&condition=supporter_KEY=thesupporter_KEY
/save
![Page 34: Where Customization Begins: An Intro to the Salsa API and Salsascript](https://reader034.vdocuments.us/reader034/viewer/2022042700/554ed772b4c905d1158b474f/html5/thumbnails/34.jpg)
www.salsalabs.com
creating a completely new supporterhttps://hq-salsa.democracyinaction.org/save?xml&object=supporter&organization_KEY=yourorganization_KEY&key=0&City=myCity&First_Name=Tester&[email protected]
/save continued
![Page 35: Where Customization Begins: An Intro to the Salsa API and Salsascript](https://reader034.vdocuments.us/reader034/viewer/2022042700/554ed772b4c905d1158b474f/html5/thumbnails/35.jpg)
www.salsalabs.com
● http://www.salsalabs.com/devs/recipes/data_api/synchronize
● http://www.salsalabs.com/devs/recipes/data_api/event_signups
Additional resources
![Page 36: Where Customization Begins: An Intro to the Salsa API and Salsascript](https://reader034.vdocuments.us/reader034/viewer/2022042700/554ed772b4c905d1158b474f/html5/thumbnails/36.jpg)
www.salsalabs.com
![Page 37: Where Customization Begins: An Intro to the Salsa API and Salsascript](https://reader034.vdocuments.us/reader034/viewer/2022042700/554ed772b4c905d1158b474f/html5/thumbnails/37.jpg)
www.salsalabs.com
![Page 38: Where Customization Begins: An Intro to the Salsa API and Salsascript](https://reader034.vdocuments.us/reader034/viewer/2022042700/554ed772b4c905d1158b474f/html5/thumbnails/38.jpg)
www.salsalabs.com
https://docs.google.com/spreadsheet/ccc?key=0AmFGN9Kd_fgSdEpXV0FCYWlHSi16ZVMtNGJwLTlnUnc#gid=0
sign up to help prioritize help us help you!
Participate!
![Page 39: Where Customization Begins: An Intro to the Salsa API and Salsascript](https://reader034.vdocuments.us/reader034/viewer/2022042700/554ed772b4c905d1158b474f/html5/thumbnails/39.jpg)
www.salsalabs.com
Power API -- using SalsaScript
![Page 40: Where Customization Begins: An Intro to the Salsa API and Salsascript](https://reader034.vdocuments.us/reader034/viewer/2022042700/554ed772b4c905d1158b474f/html5/thumbnails/40.jpg)
www.salsalabs.com
https://secure.engenderhealth.org/o/1222/p/d/engenderhealth/donations/public/secure-donation-v3-x2.sjs
Beautiful Example
![Page 41: Where Customization Begins: An Intro to the Salsa API and Salsascript](https://reader034.vdocuments.us/reader034/viewer/2022042700/554ed772b4c905d1158b474f/html5/thumbnails/41.jpg)
www.salsalabs.com
![Page 42: Where Customization Begins: An Intro to the Salsa API and Salsascript](https://reader034.vdocuments.us/reader034/viewer/2022042700/554ed772b4c905d1158b474f/html5/thumbnails/42.jpg)
www.salsalabs.com
![Page 43: Where Customization Begins: An Intro to the Salsa API and Salsascript](https://reader034.vdocuments.us/reader034/viewer/2022042700/554ed772b4c905d1158b474f/html5/thumbnails/43.jpg)
www.salsalabs.com
Eat your own dog food.
EYDF
![Page 44: Where Customization Begins: An Intro to the Salsa API and Salsascript](https://reader034.vdocuments.us/reader034/viewer/2022042700/554ed772b4c905d1158b474f/html5/thumbnails/44.jpg)
www.salsalabs.com
https://secure.flickr.com/photos/28863939@N04/5419597517/
TA DA!
UniqueBeautifulall your own
![Page 45: Where Customization Begins: An Intro to the Salsa API and Salsascript](https://reader034.vdocuments.us/reader034/viewer/2022042700/554ed772b4c905d1158b474f/html5/thumbnails/45.jpg)
www.salsalabs.com
http://www.salsalabs.com/devs/developer_signup
Additional Resources