-
Notifications
You must be signed in to change notification settings - Fork 1
Basic requests
Alexander Ose edited this page Apr 25, 2015
·
1 revision
Sieve requests begin as JSON objects with the following layout:
{
"url" : "https://api.github.com/repos/alexose/sieve/commits",
"selector" : ".commit .date"
}
By default, Sieve uses the JSONSelect engine. If your target URL doesn't return raw JSON, however, you can specify other selector engines:
{
"url" : "http://google.com/finance",
"selector" : "//td[@class='price']",
"engine" : "xpath"
};
You can run this request from your node application like so:
sieve.get(request, function(result){
console.log(result);
});
Which will log the following data to the console:
{
"result":[
"2014-02-12T18:19:31Z",
"2014-02-12T18:19:31Z",
"2014-02-12T15:36:45Z",
"2014-02-12T15:36:45Z",
"2014-02-12T15:00:53Z"
]
}