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
+49Lines changed: 49 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,6 +38,41 @@ const webflow = new Webflow({
38
38
});
39
39
```
40
40
41
+
## Transitioning to API v2
42
+
43
+
We're actively working on a new version of the SDK that will fully support API v2. In the meantime, to make use of API v2 with our SDK, there are some important changes you need to be aware of:
44
+
45
+
### Setting Up For API v2
46
+
47
+
When initializing your client, it's crucial to set the `beta` flag to true in the client options. This ensures you're targeting the API v2 endpoints.
Please note, when the beta flag is set, several built-in methods will not be available. These methods include, but are not limited to, info, authenticatedUser, sites, site, etc. Attempting to use these will throw an error.
54
+
55
+
### Calling API v2 Endpoints
56
+
57
+
To interact with API v2, you'll need to move away from using built-in methods, and instead use the provided HTTP methods directly.
58
+
59
+
For instance, where you previously used `sites()`:
60
+
61
+
```javascript
62
+
// get the first site
63
+
const [site] =awaitwebflow.sites();
64
+
```
65
+
66
+
For API v2, you will need to use direct HTTP methods:
67
+
68
+
```javascript
69
+
// get the first site
70
+
constsites=awaitwebflow.get("/sites");
71
+
constsite= sites[0];
72
+
```
73
+
74
+
We understand that this is a shift in how you interact with the SDK, but rest assured, our upcoming SDK version will streamline this process and offer a more integrated experience with API v2.
The v2 API introduces the concept of 'scopes', providing more control over app permissions. Instead of using the scope parameter as a single string, you can define multiple permissions using the scopes array:
0 commit comments