Created
July 30, 2018 11:37
-
-
Save ThomasPe/5fc8e43dd888f378234d3a7d84e74ce3 to your computer and use it in GitHub Desktop.
Get WordPress data from REST API
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
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