micnews / apple-news

A Node.js client for interacting with the Apple News API :newspaper:

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

What is the bundle files in create article.

surinder-enest opened this issue · comments

Here is the structure of how I'm using this

appleNewsObject = {"title":"dd","version":"1.5","language":"en","identifier":"dd","metadata":{"thumbnailURL":"ddd"},"layout":{"columns":"10","width":"1024","margin":"85","gutter":"20"},"components":[{"role":"heading1","text":"HEADING"},{"role":"title","text":"dd"},{"role":"intro"},{"role":"byline","text":"dddd"},{"role":"body","format":"html","text":"

Add some text here

"},{"role":"body","format":"html","text":"

Add some text here

"}]}

https://www.mydomain.com/test/article.json

My Json file has same data as "appleNewsObject"

var metadata = {}

client.createArticle({
channelId: accounts[index].channelId,
article: appleNewsObject,
bundleFiles: [
'https://www.mydomain.com/test/article.json',
metadata
],
}, (err, response) => {
if (err) {
console.log(err);
} else {
console.log(response);
}
});

This is giving me file type error for file "https://www.mydomain.com/test/article.json"

Please reply asap. I need the solution really urgent

commented

@dharamEnest Hi! article.json file shouldn't be in the bundleFiles list. The actual article content (json as js object) should be provided in the article property.
See example https://github.com/micnews/apple-news/blob/master/live-test/live-api-test.js#L86