Я новичок в webhooks и пытается выяснить, как получить объект JSON и сохранить его в Parse.comПроводка JSON в webhook на Parse.com
Вот что мой Express.js webhook выглядит следующим образом:
// These two lines are required to initialize Express in Cloud Code.
var express = require('express');
var app = express();
// Global app configuration section
app.set('views', 'cloud/views'); // Specify the folder to find templates
app.set('view engine', 'ejs'); // Set the template engine
app.use(express.bodyParser()); // Middleware for reading request body
app.post('/notify_message',
// express.basicAuth('', ''),
function(data) {
// Use Parse JavaScript SDK to create a new message and save it.
var Kenpom = Parse.Object.extend("Kenpom");
var kenpom = new Kenpom();
kenpom.save({
conference : data.results,
}).then(function(kenpom) {
res.send('Success');
}, function(error) {
res.status(500);
res.send('Error');
});
});
// Attach the Express app to Cloud Code.
app.listen();
Это объект JSON, который послан в webhook:
{
"name": "REST",
"count": 351,
"frequency": "Every 15 mins",
"version": 198,
"newdata": false,
"lastrunstatus": "success",
"lastsuccess": "Tue Mar 03 2015 02:41:02 GMT+0000 (UTC)",
"thisversionstatus": "success",
"nextrun": "Tue Mar 03 2015 03:29:21 GMT+0000 (UTC)",
"thisversionrun": "Tue Mar 03 2015 02:41:02 GMT+0000 (UTC)",
"results": {
"collection1": [
{
"rank": "1",
"team": {
"href": "http://kenpom.com/team.php?team=Kentucky",
"text": "Kentucky"
},
"conference": {
"href": "http://kenpom.com/conf.php?c=SEC",
"text": "SEC"
},
"currentrecord": "29-0",
"pyth": ".9790",
"offensiveefficiency": "118.7",
"defensiveefficiency": "84.9",
"tempo": "63.6"
},
{
"rank": "2",
"team": {
"href": "http://kenpom.com/team.php?team=Arizona",
"text": "Arizona"
},
"conference": {
"href": "http://kenpom.com/conf.php?c=P12",
"text": "P12"
},
"currentrecord": "26-3",
"pyth": ".9649",
"offensiveefficiency": "115.8",
"defensiveefficiency": "86.8",
"tempo": "66.6"
}, ....
Parse.com получающий все столбцы, но объект я вижу в Разборе просто: {}
Это эти данные от KimonoLabs.com? Я пытаюсь использовать Parse.com для доступа к данным webhook от KimonoLabs. Я не знаю, как предоставить URL-адрес webhook от Parse to KimonoLabs. –