Duplicate a Story
https://mapi.storyblok.com/v1/spaces/:space_id/stories/:story_id/duplicateThis endpoint can be used to duplicate a story into another folder.
Path parameters
Section titled “Path parameters”- :space_id required number
Numeric ID of a space
- :story_id required number
ID of the story
Request body properties
Section titled “Request body properties”- story The Story Object
Any attributes sent here will be copied to the duplicated story. To link duplicated stories as alternates, specify a
group_idin thestoryobject. - target_dimension number
The
idof the target folder. - same_path boolean
If set to
true, the current story’spathattribute will used for the duplicated story.
Response properties
Section titled “Response properties”- story The Story Object
A single story object
Examples
Section titled “Examples”curl "https://mapi.storyblok.com/v1/spaces/296898/stories/531458099/duplicate" \ -X PUT \ -H "Authorization: YOUR_OAUTH_TOKEN" \ -H "Content-Type: application/json" \ -d "{\"same_path\":true,\"story\":{\"group_id\":\"4f77133f-bb1c-4799-a54d-b6217107247f\"},\"target_dimension\":531452775}"// Using the Universal JavaScript Client:// https://github.com/storyblok/storyblok-js-clientStoryblok.put('spaces/296898/stories/531458099/duplicate', { "same_path": true, "story": { "group_id": "4f77133f-bb1c-4799-a54d-b6217107247f" }, "target_dimension": 531452775}) .then(response => { console.log(response) }).catch(error => { console.log(error) })$client = new \Storyblok\ManagementClient('YOUR_OAUTH_TOKEN');
$payload = ["same_path" => true,"story" => ["group_id" => "4f77133f-bb1c-4799-a54d-b6217107247f"],"target_dimension" => 531452775];
$client->put('spaces/296898/stories/531458099/duplicate', $payload)->getBody();HttpResponse<String> response = Unirest.put("https://mapi.storyblok.com/v1/spaces/296898/stories/531458099/duplicate") .header("Content-Type", "application/json") .header("Authorization", "YOUR_OAUTH_TOKEN") .body({"same_path":true,"story":{"group_id":"4f77133f-bb1c-4799-a54d-b6217107247f"},"target_dimension":531452775}) .asString();var client = new RestClient("https://mapi.storyblok.com/v1/spaces/296898/stories/531458099/duplicate");var request = new RestRequest(Method.PUT);
request.AddHeader("Content-Type", "application/json");request.AddHeader("Authorization", "YOUR_OAUTH_TOKEN");request.AddParameter("application/json", "{\"same_path\":true,\"story\":{\"group_id\":\"4f77133f-bb1c-4799-a54d-b6217107247f\"},\"target_dimension\":531452775}", ParameterType.RequestBody);IRestResponse response = client.Execute(request);import requests
url = "https://mapi.storyblok.com/v1/spaces/296898/stories/531458099/duplicate"
querystring = {}
payload = {"same_path":true,"story":{"group_id":"4f77133f-bb1c-4799-a54d-b6217107247f"},"target_dimension":531452775}headers = { 'Content-Type': "application/json", 'Authorization': "YOUR_OAUTH_TOKEN"}
response = requests.request("PUT", url, data=payload, headers=headers, params=querystring)
print(response.text)require 'storyblok'client = Storyblok::Client.new(oauth_token: 'YOUR_OAUTH_TOKEN')
payload = {"same_path" => true,"story" => {"group_id" => "4f77133f-bb1c-4799-a54d-b6217107247f"},"target_dimension" => 531452775}
client.put('spaces/296898/stories/531458099/duplicate', payload)import Foundation
let headers = [ "Content-Type": "application/json", "Authorization": "YOUR_OAUTH_TOKEN"]
let postData = NSData(data: {"same_path":true,"story":{"group_id":"4f77133f-bb1c-4799-a54d-b6217107247f"},"target_dimension":531452775}.data(using: String.Encoding.utf8)!)
let request = NSMutableURLRequest(url: NSURL(string: "https://mapi.storyblok.com/v1/spaces/296898/stories/531458099/duplicate")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0)request.method = "PUT"request.allHTTPHeaderFields = headersrequest.httpBody = postData as Data
let session = URLSession.sharedlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) }})
dataTask.resume()Get in touch with the Storyblok community