Skip to content
This repository was archived by the owner on Oct 10, 2022. It is now read-only.

Commit a779f0f

Browse files
authored
Update README.md
1 parent ae769db commit a779f0f

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,29 @@ const client = new NetlifyAPI('1234myAccessToken')
1212
const sites = await client.listSites()
1313
```
1414

15+
## Using Open API methods
16+
17+
```
18+
const NetlifyAPI = require('netlify')
19+
const client = new NetlifyAPI('1234myAccessToken')
20+
21+
// Fetch sites
22+
const sites = await client.listSites()
23+
24+
// Create a site. Notice `body` here for sending OpenAPI body
25+
const site = await netlify.createSite({
26+
body: {
27+
name: `my-awesome-site`
28+
// ... https://open-api.netlify.com/#/default/createSite
29+
}
30+
})
31+
32+
// Delete site. Notice `site_id` is a path parameter https://open-api.netlify.com/#/default/deleteSite
33+
await netlify.deleteSite({
34+
site_id: siteId
35+
})
36+
```
37+
1538
## API
1639

1740
### `client = new NetlifyAPI([accessToken], [opts])`

0 commit comments

Comments
 (0)