I'm trying to pass some parameters with my API request so I can get data that's already filtered.
I'm using a module called Purest and it's basically a REST API client library. It supports making expressive query call as per Purest Query API
And, my API provider is Pocket and their documentation says the following more info here.
contentType
article = only return articles
video = only return videos or articles with embedded videos
image = only return images
sort
newest = return items in order of newest to oldest
oldest = return items in order of oldest to newest
title = return items in order of title alphabetically
site = return items in order of url alphabetically
Now, I want to get video data and sort it by newest. But I'm short on clues how to add these parameters in my query.
Below is what I've tried but I'm getting 400 Bad Request
. Not also sure what to put in select because I don't know the table name of this database.
var Purest = require('purest')
, getpocket = new Purest({provider:'getpocket'})
getpocket.query()
.select('')
.where({contentType:'video'},{sort:'newest'})
.post('get')
.auth('xxxxx', 'xxxxx')
.request(function (err, res, body) {
console.log(body);
})