Skip to content

Instantly share code, notes, and snippets.

@ThomasPe

ThomasPe/getData.js

Created Jul 30, 2018
Embed
What would you like to do?
Get WordPress data from REST API
function getData(){
context.log('get data');
var options = {
url: 'https://windowsarea.de/wp-json/wp/v2/posts',
method: 'GET',
json: true
}
request(options, function (error, response, data) {
context.log("request callback");
if (error) {
context.log(error);
}
else {
context.log(data.length);
mynews = data;
}
prepareTemplates();
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.