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
+42-15Lines changed: 42 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,10 +43,16 @@ use Storyblok\ManagementApi\ManagementApiClient;
43
43
/** @var ManagementApiClient $client */
44
44
$client = new ManagementApiClient($storyblokPersonalAccessToken);
45
45
```
46
+
47
+
### Setting the space region
48
+
46
49
The second optional parameter is for setting the region.
50
+
51
+
> If you are interested to know more about Storyblok regions, check this FAQ: <https://www.storyblok.com/faq/where-are-your-servers-or-aws-sites-located>
52
+
47
53
We provide an Enum class to set the region. In this case, you can use the `Region` enum: `Region::US` or `Region::AP` or `Region::CA` or `Region::CN`.
48
54
49
-
For example, for using the US region, you can use:
55
+
For example, for using the **US** region, you can use:
50
56
```php
51
57
52
58
use \Storyblok\ManagementApi\Data\Enum\Region;
@@ -90,7 +96,7 @@ The Storyblok **Management API Client** provides two main approaches for interac
90
96
91
97
The `ManagementApi` class offers a flexible, generic interface for managing content. It includes methods to get, create, update, and delete content. With this approach, you can define the endpoint path and pass query string parameters as a generic array. The response is returned as a `StoryblokData` object, allowing you to access the JSON payload, status codes, and other details directly.
92
98
93
-
Alternatively, you can leverage dedicated classes like `SpaceApi`, which are tailored to specific resources. For instance, the `SpaceApi` class provides methods for managing spaces and returns specialized data objects, such as `SpaceData` (for a single space) or `SpacesData` (for a collection of spaces). These classes simplify interactions with specific endpoints by offering resource-specific methods.
99
+
Alternatively, you can leverage dedicated classes like `SpaceApi`, which are tailored to specific resources. For instance, the `SpaceApi` class provides methods for managing spaces and returns specialized data objects, such as `Space` (for a single space) or `Spaces` (for a collection of spaces). These classes simplify interactions with specific endpoints by offering resource-specific methods.
94
100
95
101
If a dedicated API class like `SpaceApi` or `StoryApi` does not exist for your desired endpoint, you can always fall back to the more versatile `ManagementApi` class.
96
102
@@ -112,35 +118,56 @@ Let's start analyzing the specialized classes, like for example the `SpaceApi`.
112
118
Fetch a list of all spaces associated with your account in the current region (the region is initialized in the `ManagementApiClient`):
113
119
114
120
```php
121
+
122
+
$clientEU = new ManagementApiClient($accessToken);
0 commit comments