Use a REST API: Difference between revisions

Adding a method to create venues.
(Adding a way to add lat/lon in the Javascript version)
(Adding a method to create venues.)
Line 325:
}
 
var getEventget = function(params, callback, path) {
params.key = key;
 
Line 340:
 
 
var postEventpost = function(details, callback, path) {
details.key = key;
 
request.post({
headers: { 'content-type' : 'application/x-www-form-urlencoded' },
url: url + (path || '/2/event'),
form: details
}, function(err, res, body) {
Line 353:
 
var parseEvent = function(mEvent) {
/*
* A simple function that converts JSON to
* string in a pretty way
**/
var name = mEvent['name'] || '';
var desc = mEvent['desc'] || '';
Line 388 ⟶ 392:
 
return {
getEventget: getEventget,
parseEvents: parseEvents,
postEventpost: postEventpost
}
}
Line 396 ⟶ 400:
 
 
meetup().getEventget({
// SeeMore Info: http://www.meetup.com/meetup_api/docs/2/groupsopen_events/ for more options
topic: 'photo',
city: 'nyc'
Line 412 ⟶ 417:
* Running the code below with the group name will give the group ID, an integer.
 
meetup().getEventget({
'group_urlname': 'foodie-programmers'
}, function(group) {
Line 420 ⟶ 425:
* Using the above group_id and the group_urlname manually,
* you can post events to a group with the below code
**/
 
meetup().postEventpost({
// More Info: http://www.meetup.com/meetup_api/docs/:urlname/venues/#create
name: 'Finding Nemo',
address_1: 'p sherman 42 wallaby way sydney',
city: 'sydney',
country: 'australia',
// state: needed if in US or CA.
}, function(venue) {
console.log('Venue: ', venue, venue.id);
// Prints a venue ID that can be used to create a event
}, '/' + '{{ foodie-programmers }}' + '/venus');
// This needs a valid urlname for the group
 
 
meetup().postEvent({
meetup().post({
// See http://www.meetup.com/meetup_api/docs/2/groups/ for more options
// More Info: http://www.meetup.com/meetup_api/docs/2/groups/
group_id: 42, // Group ID goes here
group_urlname: 'foodie-programmers',
Line 433 ⟶ 451:
why: 'We should do this because... Less than 250 characters',
hosts: 'up to 5 comma separated member ids',
venue_id: 'Numeric42, // Integer, ID of venue',. Venue can be created with the above.
lat: '42, // Latitude', Integer
lon: '42, // Longitude', Integer
simple_html_description: 'Event description in <b>simple html</b>. Less than <i>50000</i> characters.'
}, function(result) {
console.log('Event: ', result);
})</lang>
 
Anonymous user