You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+9-5Lines changed: 9 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -210,13 +210,17 @@ $stories = $storyApi->page(
210
210
### Filtering stories via query filters
211
211
212
212
Besides using query parameters to filter stories, you can leverage more powerful query filters.
213
+
214
+
> If you need to handle pagination (retrieving all stories across multiple pages) or create multiple stories at once, you can use the `StoryBulkApi` instead of the `StoryApi` class.
215
+
213
216
In this example, you will retrieve all stories where the "title" field is empty. (Stories with content types that do not include a "title" field in their schema will be skipped.)
214
217
215
218
```php
216
219
use Storyblok\ManagementApi\QueryParameters\Filters\Filter;
217
220
use Storyblok\ManagementApi\QueryParameters\Filters\QueryFilters;
218
221
219
-
$stories = $storyApi->all(
222
+
$storyBulkApi = $client->storyBulkApi($spaceId);
223
+
$stories = $storyBulkApi->all(
220
224
filters: (new QueryFilters())->add(
221
225
new Filter(
222
226
"title",
@@ -298,7 +302,7 @@ $storyApi->publish($storyId);
298
302
299
303
300
304
### Creating stories in bulk
301
-
You can create multiple stories using the `createBulk()` method, which processes an array of stories while managing rate limits through a retry mechanism that respects the '429' status code.
305
+
You can create multiple stories using the `createStories()` method (in the `StoryBulkApi` class), which processes an array of stories while managing rate limits through a retry mechanism that respects the '429' status code.
302
306
303
307
For example, if you have a CSV file containing content for new stories, you can use this method to efficiently create them.
304
308
@@ -308,10 +312,10 @@ myslug-002;My Story 2 BULK;page
308
312
myslug-003;My Story 3 BULK;page
309
313
```
310
314
311
-
Next, you can implement a script to load and parse the CSV file. In this case, we use `SplFileObject` and then call the `createBulk` method to process the data:
315
+
Next, you can implement a script to load and parse the CSV file. In this case, we use `SplFileObject` and then call the `createStories` method to process the data:
0 commit comments