Skip to content

Instantly share code, notes, and snippets.

@DominikAngerer
Created January 16, 2020 10:06
Show Gist options
  • Save DominikAngerer/3612b7456f56da4d87384d6ca0897081 to your computer and use it in GitHub Desktop.
Save DominikAngerer/3612b7456f56da4d87384d6ca0897081 to your computer and use it in GitHub Desktop.
const Storyblok = require('storyblok-js-client') // npm install storyblok-js-client
const MAPI_TOKEN = "your_oauth_token"
const spaceId = 73358 // your configured space id folder
const yourFolderId = 5663791 // your parent folder
let StoryblokClient = new Storyblok({
oauthToken: MAPI_TOKEN
})
let content = {
"story": {
"name": "courses",
"slug": "courses",
"parent_id": yourFolderId,
"is_folder": false,
"is_startpage": true,
"content": {
"component": "course-overview",
"stageImgDesktop": "/~/media/efcom/2017/ils/courses/overview-page/ILSU_Overview-Page_Desktop.jpg",
"stageImgMobile": "/~/media/efcom/2017/ils/courses/overview-page/ILSU_Overview_Mobile.jpg"
}
},
"publish": 1
}
StoryblokClient.post(`spaces/${spaceId}/stories/`, content)
.then((response) => {
console.log(response)
}).catch(error => {
console.log(error)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment