Skip to content

Commit 865ccdb

Browse files
authored
Rename SDK to Client in files and diagrams (strapi#2381)
* Rename SDK to Client in files and diagrams * Remove badge causing alignment issues * Fix order in What's New page
1 parent b044109 commit 865ccdb

File tree

7 files changed

+39
-33
lines changed

7 files changed

+39
-33
lines changed

docusaurus/docs/dev-docs/api/sdk-js.md renamed to docusaurus/docs/dev-docs/api/client.md

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
---
2-
title: JavaScript SDK
2+
title: Strapi Client
3+
description: The Strapi Client library simplifies interactions with your Strapi back end, providing a way to fetch, create, update, and delete content.
34
displayed_sidebar: devDocsSidebar
45
tags:
56
- API
67
- Content API
78
- documentId
8-
- JavaScript SDK
9+
- Strapi Client
910
---
1011

11-
# JavaScript SDK
12+
# Strapi Client
1213

13-
The Strapi JavaScript SDK simplifies interactions with your Strapi back end, providing a way to fetch, create, update, and delete content. This guide walks you through setting up the JavaScript SDK, configuring authentication, and using its key features effectively.
14+
The Strapi Client library simplifies interactions with your Strapi back end, providing a way to fetch, create, update, and delete content. This guide walks you through setting up the Strapi Client, configuring authentication, and using its key features effectively.
1415

1516
## Getting Started
1617
:::prerequisites
@@ -20,60 +21,60 @@ The Strapi JavaScript SDK simplifies interactions with your Strapi back end, pro
2021

2122
### Installation
2223

23-
To use the JavaScript SDK in your project, install it as a dependency using your preferred package manager:
24+
To use the Strapi Client in your project, install it as a dependency using your preferred package manager:
2425

2526
<Tabs groupId="yarn-npm">
2627
<TabItem value="yarn" label="Yarn">
2728

2829
```bash
29-
yarn add @strapi/sdk-js
30+
yarn add @strapi/client
3031
```
3132

3233
</TabItem>
3334
<TabItem value="npm" label="NPM">
3435

3536
```bash
36-
npm install @strapi/sdk-js
37+
npm install @strapi/client
3738
```
3839

3940
</TabItem>
4041
<TabItem value="pnpm" label="pnpm">
4142

4243
```bash
43-
pnpm add @strapi/sdk-js
44+
pnpm add @strapi/client
4445
```
4546

4647
</TabItem>
4748
</Tabs>
4849

4950
### Basic configuration
5051

51-
To start interacting with your Strapi back end, initialize the JavaScript SDK and set the base API URL:
52+
To start interacting with your Strapi back end, initialize the Strapi Client and set the base API URL:
5253

5354
```js
54-
import { strapi } from '@strapi/sdk-js';
55+
import { strapi } from '@strapi/client';
5556

56-
const sdk = strapi({ baseURL: 'http://localhost:1337/api' });
57+
const client = strapi({ baseURL: 'http://localhost:1337/api' });
5758
```
5859

59-
If you're using the JavaScript SDK in a browser environment, you can include it using a `<script>` tag:
60+
If you're using the Strapi Client in a browser environment, you can include it using a `<script>` tag:
6061

6162
```js title="./src/api/[apiName]/routes/[routerName].ts (e.g './src/api/restaurant/routes/restaurant.ts')"
62-
<script src="https://cdn.jsdelivr.net/npm/@strapi/sdk-js"></script>
63+
<script src="https://cdn.jsdelivr.net/npm/@strapi/client"></script>
6364

6465
<script>
65-
const sdk = strapi.strapi({ baseURL: 'http://localhost:1337/api' });
66+
const client = strapi.strapi({ baseURL: 'http://localhost:1337/api' });
6667
</script>
6768
```
6869

6970
### Authentication
7071

71-
The JavaScript SDK supports different authentication strategies to access protected resources in your Strapi back end.
72+
The Strapi Client supports different authentication strategies to access protected resources in your Strapi back end.
7273

73-
If your Strapi instance uses API tokens, configure the JavaScript SDK as follows:
74+
If your Strapi instance uses API tokens, configure the Strapi Client as follows:
7475

7576
```js
76-
const sdk = strapi({
77+
const client = strapi({
7778
baseURL: 'http://localhost:1337/api',
7879
auth: 'your-api-token-here',
7980
});
@@ -83,7 +84,7 @@ This allows your requests to include the necessary authentication credentials au
8384

8485
## API Reference
8586

86-
The JavaScript SDK provides the following key properties and methods for interacting with your Strapi back end:
87+
The Strapi Client provides the following key properties and methods for interacting with your Strapi back end:
8788

8889
| Parameter | Description |
8990
| ----------| -------------------------------------------------------------------------------------------- |
@@ -94,15 +95,15 @@ The JavaScript SDK provides the following key properties and methods for interac
9495

9596
### General purpose fetch
9697

97-
The JavaScript SDK provides access to the underlying JavaScript `fetch` function to make direct API requests. The request is always relative to the base URL provided during SDK initialization:
98+
The Strapi Client provides access to the underlying JavaScript `fetch` function to make direct API requests. The request is always relative to the base URL provided during client initialization:
9899

99100
```js
100-
const result = await strapiSdk.fetch('articles', { method: 'GET' });
101+
const result = await client.fetch('articles', { method: 'GET' });
101102
```
102103

103104
### Working with collection types
104105

105-
Collection types in Strapi are entities with multiple entries (e.g., a blog with many posts). The JavaScript SDK provides a `collection()` method to interact with these resources, with the following methods available:
106+
Collection types in Strapi are entities with multiple entries (e.g., a blog with many posts). The Strapi Client provides a `collection()` method to interact with these resources, with the following methods available:
106107

107108
| Parameter | Description |
108109
| ----------| -------------------------------------------------------------------------------------------- |
@@ -114,12 +115,15 @@ Collection types in Strapi are entities with multiple entries (e.g., a blog with
114115

115116
**Usage examples:**
116117
```js
117-
const articles = sdk.collection('articles');
118+
const articles = client.collection('articles');
118119

119-
// Fetch all English articles sorted by title
120-
const allArticles = await articles.find({ locale: 'en', sort: 'title' });
120+
// Fetch all english articles sorted by title
121+
const allArticles = await articles.find({
122+
locale: 'en',
123+
sort: 'title',
124+
});
121125

122-
// Fetch a single article by ID
126+
// Fetch a single article
123127
const singleArticle = await articles.findOne('article-document-id');
124128

125129
// Create a new article
@@ -134,7 +138,7 @@ await articles.delete('article-id');
134138

135139
### Working with single types
136140

137-
Single types in Strapi represent unique content entries that exist only once (e.g., the homepage settings or site-wide configurations). The JavaScript SDK provides a `single()` method to interact with these resources, with the following methods available:
141+
Single types in Strapi represent unique content entries that exist only once (e.g., the homepage settings or site-wide configurations). The Strapi Client provides a `single()` method to interact with these resources, with the following methods available:
138142
| Parameter | Description |
139143
| ----------| -------------------------------------------------------------------------------------------- |
140144
| `find(queryParams?)` | Fetch the document. |
@@ -143,7 +147,7 @@ Single types in Strapi represent unique content entries that exist only once (e.
143147

144148
**Usage examples:**
145149
```js
146-
const homepage = sdk.single('homepage');
150+
const homepage = client.single('homepage');
147151

148152
// Fetch the default homepage content
149153
const defaultHomepage = await homepage.find();
@@ -162,5 +166,5 @@ await homepage.delete();
162166
```
163167

164168
:::strapi Additional information
165-
More details about the Strapi JavaScript SDK might be found in the [package's README](https://github.com/strapi/sdk-js/blob/main/README.md).
169+
More details about the Strapi Strapi Client might be found in the [package's README](https://github.com/strapi/client-js/blob/main/README.md).
166170
:::

docusaurus/docs/dev-docs/api/content-api.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ From a front-end application, your content can be accessed through Strapi's Cont
2222
- by default through the [REST API](/dev-docs/api/rest)
2323
- and also through the [GraphQL API](/dev-docs/api/graphql) if you installed the Strapi built-in [GraphQL plugin](/dev-docs/plugins/graphql).
2424

25-
You can also use the [JavaScript SDK](/dev-docs/api/sdk-js) to interact with the REST API.
25+
You can also use the [Strapi Client](/dev-docs/api/client) to interact with the REST API.
2626

2727
REST and GraphQL APIs represent the top-level layers of the Content API exposed to external applications. Strapi also provides 2 lower-level APIs:
2828

@@ -47,7 +47,7 @@ This documentation section includes reference information about the following St
4747

4848
<CustomDocCard emoji="↕️" title="GraphQL API" description="Query the Content API from a front-end application through GraphQL." link="/dev-docs/api/graphql" />
4949

50-
<CustomDocCard emoji="↕️" title="JavaScript SDK" description="Interact with the REST API through the JavaScript SDK." link="/dev-docs/api/sdk-js" />
50+
<CustomDocCard emoji="↕️" title="Strapi Client" description="Interact with the REST API through the Strapi Client library." link="/dev-docs/api/client" />
5151

5252
<CustomDocCard emoji="🔃" title="Document Service API" description="Query your data through the backend server or plugins." link="/dev-docs/api/document-service" />
5353

docusaurus/docs/dev-docs/api/rest.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ By default, the REST API responses only include top-level fields and does not po
3030
The Upload plugin (which handles media found in the [Media Library](/user-docs/media-library)) has a specific API described in the [Upload plugin documentation](/dev-docs/plugins/upload).
3131
:::
3232

33-
:::strapi Strapi SDK <NewBadge />
34-
Strapi has just released a new SDK, currently in beta. Early documentation is available on the [repository](https://github.com/strapi/sdk-js) while we are integrating it into the official REST API reference.
33+
:::strapi Strapi Client
34+
The [Strapi Client](/dev-docs/api/client) library simplifies interactions with your Strapi back end, providing a way to fetch, create, update, and delete content.
3535
:::
3636

3737
## Endpoints

docusaurus/docs/dev-docs/whats-new.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ Strapi 5 brings many new features and improvements, and this page quickly highli
2323

2424
<Icon name="detective"/> The **[REST API](/dev-docs/api/rest)** and **[GraphQL API](/dev-docs/api/graphql)** have been updated, with a simplified response data format for both and partial support for Relay-style queries for GraphQL.
2525

26+
<Icon name="plugs" /> The **[Strapi Client](/dev-docs/api/client)** library simplifies interactions with your Strapi back end, providing a way to fetch, create, update, and delete content.
27+
2628
<Icon name="puzzle-piece" /> The **[Plugin SDK](/dev-docs/plugins/development/plugin-sdk)** is a new CLI tool that helps you develop and publish Strapi plugins.
2729

2830
<Icon name="escalator-up" /> Another whole new CLI **[upgrade tool](/dev-docs/upgrade-tool)** will help you migrate to any patch, minor, and major version of Strapi, automating most of the common tasks through codemods.

docusaurus/sidebars.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ const sidebars = {
169169
},
170170
{
171171
type: 'doc',
172-
id: 'dev-docs/api/sdk-js',
172+
id: 'dev-docs/api/client',
173173
},
174174
{
175175
type: 'doc',
1.11 KB
Loading
606 Bytes
Loading

0 commit comments

Comments
 (0)