diff --git a/README.md b/README.md index f9478d2..2d49d83 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ func main() { }) // for eg, to get current user (GET /users/me) - currentUser, resp, body, _ := client.Users().Me() + currentUser, resp, body, _ := client.Users().Me(nil) if resp.StatusCode != http.StatusOK { // handle error } @@ -59,9 +59,9 @@ Before running the tests, ensure that you have set up your test environment ### Prerequisites - Wordpress 4.x -- WP-API plugin -- WP-API's BasicAuth plugin (for authentication) -- [WP REST API Meta Endpoints plugin](https://github.com/WP-API/wp-api-meta-endpoints) (for Meta endpoints) +- [WP-API plugin](https://wordpress.org/plugins/rest-api/) +- [WP-API's BasicAuth plugin](https://github.com/WP-API/Basic-Auth) (for authentication) - I was unable to find this plugin published anywhere outside of github. But it was easy to just choose Clone or Download -> Download ZIP. After that the downloaded ZIP can be treated as a standard plugin and just installed in WordPress via upload. +- [WP REST API Meta Endpoints plugin](https://github.com/WP-API/wp-api-meta-endpoints) (for Meta endpoints) - This can be installed through standard WordPress plugin directory [here](https://wordpress.org/plugins/rest-api-meta-endpoints/) ### Setting up test environment - Install prequisits (see above) diff --git a/client.go b/client.go index e1163ad..66f5cb4 100644 --- a/client.go +++ b/client.go @@ -201,7 +201,7 @@ func (client *Client) PostData(url string, content []byte, contentType string, f } req.Header.Set("Content-Type", contentType) - req.Header.Set("Content-Disposition", fmt.Sprintf("filename=%v", filename)) + req.Header.Set("Content-Disposition", fmt.Sprintf("attachment; filename=\"%v\"", filename)) // Add basic auth req.SetBasicAuth(s.BasicAuth.Username, s.BasicAuth.Password) diff --git a/posts.go b/posts.go index e082b7a..67c07aa 100644 --- a/posts.go +++ b/posts.go @@ -70,11 +70,12 @@ type Post struct { Content Content `json:"content,omitempty"` Author int `json:"author,omitempty"` Excerpt Excerpt `json:"excerpt,omitempty"` - FeaturedImage int `json:"featured_image,omitempty"` + FeaturedImage int `json:"featured_media,omitempty"` CommentStatus string `json:"comment_status,omitempty"` PingStatus string `json:"ping_status,omitempty"` Format string `json:"format,omitempty"` Sticky bool `json:"sticky,omitempty"` + Categories []int `json:"categories,omitempty"` } func (entity *Post) setCollection(col *PostsCollection) {