· 6 years ago · Mar 26, 2019, 05:38 AM
1// npm install storyblok-js-client
2const StoryblokClient = require('storyblok-js-client')
3
4// Initialize the client with the oauth token so you're
5// authenticated for the management API
6const Storyblok = new StoryblokClient({
7 oauthToken: 'YOUR_OAUTH_TOKEN'
8})
9const spaceId = 'your_space_id'
10let page = 1
11
12const start = async () => {
13
14 let storiesResponse = await Storyblok.get(`spaces/${spaceId}/stories`, {
15 per_page: 100,
16 page: page,
17 sort_by:'slug:asc'
18 })
19 console.log(storiesResponse.data)
20}
21
22start()