Skip to content

Commit

Permalink
Add post requests documentation for apiFetch (#19759)
Browse files Browse the repository at this point in the history
  • Loading branch information
momotofu authored and youknowriad committed Jan 21, 2020
1 parent 942c262 commit 056dd36
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/api-fetch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,19 @@ _This package assumes that your code will run in an **ES2015+** environment. If
```js
import apiFetch from '@wordpress/api-fetch';

// GET
apiFetch( { path: '/wp/v2/posts' } ).then( posts => {
console.log( posts );
} );

// POST
apiFetch( {
path: '/wp/v2/posts/1',
method: 'POST',
data: { title: 'New Post Title' },
} ).then( res => {
console.log( res );
} );
```

### Options
Expand Down

0 comments on commit 056dd36

Please sign in to comment.