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 forceDownload(blob, filename) { | |
| var a = document.createElement('a'); | |
| a.download = filename; | |
| a.href = blob; | |
| a.click(); | |
| } | |
| // Current blob size limit is around 500MB for browsers | |
| function downloadResource(url, filename) { | |
| if (!filename) |
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
| import requests | |
| auth_token = 'your_token' | |
| url = "https://api.storyblok.com/v1/spaces" | |
| payload = "{\"space\":{\"name\":\"Space B\",\"domain\":\"http://example.storyblok.com\"}}" | |
| headers = { | |
| 'Accept': "application/json", | |
| 'Content-Type': "application/json", |
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
| import requests | |
| # Got from https://app.storyblok.com/#!/me/account (Personal access token) | |
| auth_token = 'YOUR_TOKEN' | |
| class Client: | |
| def __init__(self, auth_token): | |
| self.auth_token = auth_token | |
| def create_space(self, name, domain, parent='', dup=''): |
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
| // const axios = require('axios') | |
| // Using Links API | |
| generate: { | |
| routes: function (callback) { | |
| const token = `YOUR_TOKEN` | |
| const version = 'published' | |
| let cache_version = 0 |
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
| // example store | |
| import Vuex from 'vuex' | |
| const createStore = () => { | |
| return new Vuex.Store({ | |
| state: { | |
| work_detail: null | |
| }, | |
| state: { | |
| counter: 0 |
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
| var request = require("request"); | |
| var options = { method: 'POST', | |
| url: 'https://api.storyblok.com/v1/spaces/49233/stories', | |
| headers: | |
| { Authorization: 'auth_token', | |
| 'Content-Type': 'application/json', | |
| Accept: 'application/json' }, | |
| body: | |
| { story: |
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
| var https = require('https') | |
| var querystring = require('querystring') | |
| var AWS = require('aws-sdk') | |
| var responseHeaders = { | |
| 'Access-Control-Allow-Origin': '*', | |
| 'Access-Control-Allow-Credentials': true | |
| } | |
| var storyblokApiRequest = function(inputData, success, error) { | |
| var timestamp = Math.floor(Date.now() / 1000) | |
| var postData = JSON.stringify({ |
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
| var request = require("request"); | |
| var options = { method: 'POST', | |
| url: 'https://api.storyblok.com/v1/spaces/YOUR_SPACE_ID/stories', | |
| headers: | |
| { Authorization: 'YOUR_AUTH_TOKEN', | |
| 'Content-Type': 'application/json', | |
| Accept: 'application/json' }, | |
| body: { story: | |
| { name: 'Story 1', |
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
| const Fieldtype = { | |
| mixins: [window.Storyblok.plugin], | |
| template: ` | |
| <div> | |
| <div class="uk-grid"> | |
| <div class="uk-width-1-5" v-if="has_image"> | |
| <img :src="model.src"/> | |
| </div> | |
| <div :class="{ 'uk-width-4-5': has_image, 'uk-width-1-1': !has_image }" > | |
| <input class="uk-width-1-1" placeholder="Your image URL" v-model="model.src" /> |
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
| // You can send a POST request to the Node Application from your client side application | |
| // during your submit event with the following three examples | |
| // ---------------------------------------------------------------- | |
| // Basic XHR Example: | |
| // in your submit event: | |
| var data = JSON.stringify({ "message": "this is the message from the contact form entered by your customer" } ); | |
| var xhr = new XMLHttpRequest(); |