like
Filter stories by checking if a field partially matches the specified value.
Examples Use Cases
Section titled “Examples Use Cases”filter_query[headline][like]=Mars
Returns all stories with the word Mars
in their headline
filter_query[headline][like]=Mars*
Returns all stories where the headline starts with Mars
filter_query[headline][like]=*Mars
Returns all stories where the headline ends with Mars
filter_query[headline][like]=*Mars*
Returns all stories where the headline contains Mars
filter_query[content][like]=quantum
Returns all stories that contain quantum
in the content
field
filter_query[scheduled][like]=*
Returns all stories where scheduled
is defined and its value is blank
Example Request and Response
Section titled “Example Request and Response”The following example demonstrates how to receive all stories with space
in the headline using the like
operation.
curl "https://api.storyblok.com/v2/cdn/stories/?filter_query%5Bheadline%5D%5Blike%5D=*space*&token=ask9soUkv02QqbZgmZdeDAtt"
// Using the Universal JavaScript Client:// https://github.com/storyblok/storyblok-js-clientStoryblok.get('cdn/stories/', { "filter_query[headline][like]": "*space*"}) .then(response => { console.log(response) }).catch(error => { console.log(error) })
$client = new \Storyblok\Client('YOUR_STORYBLOK_SPACE_ACCESS_TOKEN');
$client->getStories([ "filter_query[headline][like]" => "*space*"])->getBody();
HttpResponse<String> response = Unirest.get("https://api.storyblok.com/v2/cdn/stories/?filter_query%5Bheadline%5D%5Blike%5D=*space*&token=ask9soUkv02QqbZgmZdeDAtt") .asString();
var client = new RestClient("https://api.storyblok.com/v2/cdn/stories/?filter_query%5Bheadline%5D%5Blike%5D=*space*&token=ask9soUkv02QqbZgmZdeDAtt");var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
import requests
url = "https://api.storyblok.com/v2/cdn/stories/"
querystring = {"filter_query[headline][like]":"*space*","token":"ask9soUkv02QqbZgmZdeDAtt"}
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.stories({:params => { "filter_query[headline][like]" => "*space*"}})
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "https://api.storyblok.com/v2/cdn/stories/?filter_query%5Bheadline%5D%5Blike%5D=*space*&token=ask9soUkv02QqbZgmZdeDAtt")! 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()
{ "stories": [ { "name": "Demystifying Space-Time: A Journey Through the Fabric of the Universe", "created_at": "2024-02-16T14:30:23.265Z", "published_at": "2024-03-07T15:13:47.973Z", "id": 445002670, "uuid": "65da3091-da63-4e13-933d-1c457f1e8001", "content": { "_uid": "74378dc5-7bd4-402a-9f18-e5826ab33de7", "image": { "id": 14114862, "alt": "", "name": "", "focus": "", "title": "", "source": "", "filename": "https://a.storyblok.com/f/276232/3500x2000/1b10f4c65c/black-hole.jpg", "copyright": "", "fieldtype": "asset", "meta_data": {}, "is_private": "", "is_external_url": false }, "author": "51eed33d-855f-415c-ac0d-4404e03b89e1", "topics": ["physics", "cosmology"], "content": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.", "headline": "Demystifying Space-Time: A Journey Through the Fabric of the Universe", "component": "article", "scheduled": "2024-02-23 15:00", "categories": [ "f61be9aa-a974-4235-8314-d1238fe2ecce", "98ba1610-9163-4c71-bae3-8fe00092b430", "b52d1c55-b399-4241-97d7-e3dba566a486" ], "highlighted": false }, "slug": "demystifying-space-time-journey-through-fabric-universe", "full_slug": "articles/demystifying-space-time-journey-through-fabric-universe", "sort_by_date": null, "position": 0, "tag_list": [], "is_startpage": false, "parent_id": 444991588, "meta_data": null, "group_id": "7f212389-771d-44e6-ac4c-cf6c3857118b", "first_published_at": "2024-02-16T14:30:15.805Z", "release_id": null, "lang": "default", "path": null, "alternates": [], "default_full_slug": null, "translated_slugs": null } ], "cv": 1709827198, "rels": [], "links": []}
Get in touch with the Storyblok community