Retrieve Multiple Links
Returns the links object containing all links within a space. Links are a representation of stories and folders. Links contain a limited subset of the information associated with stories, resulting in a reduced size of the API response.
https://api.storyblok.com/v2/cdn/links
Query parameters
Section titled “Query parameters”- token required string
A preview or public access token
- starts_with string
Filter by
full_slug
to only return links starting with the given value, for example:starts_with=de/beitraege
,starts_with=en/posts
. - version draft | published
Default:
published
- cv number
Cached version Unix timestamp (see Cache Invalidation)
- with_parent number
Filter by folder ID to only return links from a particular folder. Can be set to
0
to only return entries not located in a folder. - include_dates 0 | 1
Default:
0
. Set to1
to includepublished_at
,created_at
, andupdated_at
in the response. - page number
Default:
1
(see Pagination) - per_page number
Default:
25
, Max:1000
(see Pagination) - paginated 0 | 1
Set to
1
to enable pagination (see note above)
Response properties
Section titled “Response properties”- links object
An object of link objects (each key constitutes a story or folder UUID)
Examples
Section titled “Examples”curl "https://api.storyblok.com/v2/cdn/links?token=krcV6QGxWORpYLUWt12xKQtt&version=published&starts_with=articles"
// Using the Universal JavaScript Client:// https://github.com/storyblok/storyblok-js-clientStoryblok.get('cdn/links', { "version": "published", "starts_with": "articles"}) .then(response => { console.log(response) }).catch(error => { console.log(error) })
$client = new \Storyblok\Client('YOUR_STORYBLOK_SPACE_ACCESS_TOKEN');
$client->getLinks([ "version" => "published", "starts_with" => "articles"])->getBody();
HttpResponse<String> response = Unirest.get("https://api.storyblok.com/v2/cdn/links?token=krcV6QGxWORpYLUWt12xKQtt&version=published&starts_with=articles") .asString();
var client = new RestClient("https://api.storyblok.com/v2/cdn/links?token=krcV6QGxWORpYLUWt12xKQtt&version=published&starts_with=articles");var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
import requests
url = "https://api.storyblok.com/v2/cdn/links"
querystring = {"token":"krcV6QGxWORpYLUWt12xKQtt","version":"published","starts_with":"articles"}
payload = ""headers = {}
response = requests.request("GET", url, data=payload, headers=headers, params=querystring)
print(response.text)
require 'storyblok'client = Storyblok::Client.new(token: 'YOUR_TOKEN')
client.links({:params => { "version" => "published", "starts_with" => "articles"}})
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "https://api.storyblok.com/v2/cdn/links?token=krcV6QGxWORpYLUWt12xKQtt&version=published&starts_with=articles")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0)request.method = "GET"
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()
{ "links": { "47ba3d20-3962-4017-b158-b268a976b683": { "id": 444991588, "uuid": "47ba3d20-3962-4017-b158-b268a976b683", "slug": "articles", "path": null, "parent_id": null, "name": "Articles", "is_folder": true, "published": false, "is_startpage": false, "position": 0, "real_path": "/articles" }, "660452d2-1a68-4493-b5b6-2f03b6fa722b": { "id": 444996765, "uuid": "660452d2-1a68-4493-b5b6-2f03b6fa722b", "slug": "articles/earths-symphony-navigating-wonders-challenges-blue-oasis", "path": null, "parent_id": 444991588, "name": "Earth's Symphony: Navigating the Wonders and Challenges of Our Blue Oasis", "is_folder": false, "published": true, "is_startpage": false, "position": 0, "real_path": "/articles/earths-symphony-navigating-wonders-challenges-blue-oasis" }, "a2c57c06-2c5c-4819-acb7-0d9c047d16e9": { "id": 445002665, "uuid": "a2c57c06-2c5c-4819-acb7-0d9c047d16e9", "slug": "articles/mars-unveiled-exploring-mysteries-marvels-red-frontier", "path": null, "parent_id": 444991588, "name": "Mars Unveiled: Exploring the Mysteries and Marvels of the Red Frontier", "is_folder": false, "published": true, "is_startpage": false, "position": 0, "real_path": "/articles/mars-unveiled-exploring-mysteries-marvels-red-frontier" } }}
Get in touch with the Storyblok community