Created
July 1, 2014 12:23
-
-
Save riverspirit/bcf16162623aef68524a to your computer and use it in GitHub Desktop.
Connect to MindBody API using Node.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// mindbody.js | |
// Replace source_name, password and site_id values in `var params` | |
var soap = require('soap'); | |
module.exports = { | |
getClasses: function (req, res) { | |
var url = "https://api.mindbodyonline.com/0_5/ClassService.asmx?wsdl"; | |
soap.createClient(url, function (err, client) { | |
if (err) { | |
throw err; | |
} | |
client.setEndpoint('https://api.mindbodyonline.com/0_5/ClassService.asmx'); | |
var params = { | |
"Request": { | |
"SourceCredentials": { | |
"SourceName": "source_name", | |
"Password": "password", | |
"SiteIDs": { | |
"int": ["site_id"] | |
} | |
} | |
} | |
}; | |
client.Class_x0020_Service.Class_x0020_ServiceSoap.GetClasses(params, function (errs, result) { | |
if (errs) { | |
console.log(errs); | |
} else { | |
console.log(JSON.stringify(result.GetClassesResult)); | |
} | |
}) | |
}); | |
} | |
} | |
// Your application file.js | |
//var mindbody = require('./mindbody.js'); | |
//mindbody.getClasses(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment