-
Notifications
You must be signed in to change notification settings - Fork 3
/
example.js
36 lines (30 loc) · 844 Bytes
/
example.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
var changeApi = require('change-api');
var petitionUrl = 'https://www.change.org/p/medellinjs-host-more-workshops-for-all-talks',
organizationID = '5848',
apiKey = process.env.CHANGE_API_KEY,
apiSecret = process.env.CHANGE_API_SECRET;
var client = changeApi.createClient({
api_key: apiKey
});
client.petitions.getByUrl(petitionUrl,
function (err, res, body) {
console.log(body);
});
client.organizations.getPetitions({
id: organizationID,
page: 2,
page_size: 5
},
function (err, res, body) {
console.log(body);
});
client.petitions.getAuthKey({
'api_secret': apiSecret,
'petition_id': 2780461,
'source_description': 'MedellinJS site',
'source': 'http://medellinjs.org/comparte',
'requester_email': '[email protected]'
},
function (err, res, body) {
console.log(body);
});