wordpress_client 1.0.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +124 -69
  3. data/Changelog.md +4 -0
  4. data/README.md +36 -13
  5. data/lib/wordpress_client.rb +0 -3
  6. data/lib/wordpress_client/client.rb +20 -74
  7. data/lib/wordpress_client/connection.rb +9 -10
  8. data/lib/wordpress_client/media.rb +15 -1
  9. data/lib/wordpress_client/media_parser.rb +1 -0
  10. data/lib/wordpress_client/post.rb +16 -36
  11. data/lib/wordpress_client/post_parser.rb +9 -37
  12. data/lib/wordpress_client/term.rb +1 -1
  13. data/lib/wordpress_client/version.rb +1 -1
  14. data/spec/client_spec.rb +17 -181
  15. data/spec/connection_spec.rb +8 -11
  16. data/spec/docker/Dockerfile +8 -8
  17. data/spec/docker/README.md +19 -9
  18. data/spec/docker/dbdump.sql.gz +0 -0
  19. data/spec/docker/restore-dbdump.sh +2 -2
  20. data/spec/fixtures/post-with-metadata.json +99 -1
  21. data/spec/fixtures/simple-post.json +324 -1
  22. data/spec/integration/attachments_crud_spec.rb +1 -1
  23. data/spec/integration/posts_crud_spec.rb +1 -1
  24. data/spec/integration/posts_finding_spec.rb +0 -69
  25. data/spec/integration/posts_metadata_spec.rb +11 -11
  26. data/spec/integration/posts_with_attachments_spec.rb +20 -6
  27. data/spec/media_spec.rb +13 -0
  28. data/spec/post_spec.rb +5 -31
  29. data/spec/support/docker_runner.rb +25 -10
  30. data/spec/support/wordpress_server.rb +15 -7
  31. data/wordpress_client.gemspec +11 -12
  32. metadata +5 -15
  33. data/lib/wordpress_client/replace_metadata.rb +0 -82
  34. data/lib/wordpress_client/replace_terms.rb +0 -63
  35. data/spec/fixtures/post-with-forbidden-metadata.json +0 -1
  36. data/spec/integration/category_assignment_spec.rb +0 -29
  37. data/spec/integration/tag_assignment_spec.rb +0 -29
  38. data/spec/replace_metadata_spec.rb +0 -56
  39. data/spec/replace_terms_spec.rb +0 -51
@@ -9,6 +9,11 @@ RUN wget -P /var/www/html/ https://wordpress.org/latest.zip && \
9
9
  # Copy the WP-Config file
10
10
  RUN cp /var/www/html/wordpress/wp-config-sample.php /var/www/html/wordpress/wp-config.php
11
11
 
12
+ # White list custom metadata fields
13
+ RUN echo "register_meta('post', 'foo', array('type' => 'integer', 'description' => 'Some kind of integer', 'single' => true, 'show_in_rest' => true));" >>/var/www/html/wordpress/wp-config.php
14
+ RUN echo "register_meta('post', 'bar', array('type' => 'boolean', 'description' => 'Some kind of boolean', 'single' => true, 'show_in_rest' => true));" >>/var/www/html/wordpress/wp-config.php
15
+ RUN echo "register_meta('post', 'baz', array('type' => 'string', 'description' => 'Some kind of string', 'single' => true, 'show_in_rest' => true));" >>/var/www/html/wordpress/wp-config.php
16
+
12
17
  # base image only contains American timezones
13
18
  RUN yum install -y tzdata
14
19
 
@@ -29,19 +34,14 @@ COPY htaccess /var/www/html/wordpress/.htaccess
29
34
  COPY dbdump.sql.gz /tmp/dbdump.sql.gz
30
35
  COPY restore-dbdump.sh /tmp/.restore-dbdump.sh
31
36
  RUN chmod +x /tmp/.restore-dbdump.sh && \
32
- echo "if [ -f /tmp/.restore-dbdump.sh ]; then /tmp/.restore-dbdump.sh; rm /tmp/.restore-dbdump.sh; fi" >> /root/.bashrc
37
+ echo "if [ -f /tmp/.restore-dbdump.sh ]; then /tmp/.restore-dbdump.sh; rm -rf /tmp/.restore-dbdump.sh; fi" >> /root/.bashrc
33
38
 
34
- ### Install API and API Basic Auth plugins
39
+ ### Install Basic Auth plugin
40
+ # Required for API to be able to make changes
35
41
 
36
42
  # We need tar to unpack the WP plugins
37
43
  RUN yum install -y tar
38
44
 
39
- # WP API
40
- # Get download link from https://wordpress.org/plugins/rest-api/
41
- RUN curl -SL -o /tmp/rest-api.zip https://downloads.wordpress.org/plugin/rest-api.2.0-beta8.zip \
42
- && unzip /tmp/rest-api.zip -d /var/www/html/wordpress/wp-content/plugins/ \
43
- && rm /tmp/rest-api.zip
44
-
45
45
  # Basic Auth
46
46
  # Get download link from GitHub or something.
47
47
  RUN curl -SL https://github.com/WP-API/Basic-Auth/archive/master.tar.gz \
@@ -26,35 +26,45 @@ This image is based on Appcontainer's Wordpress image, which runs Apache, MySQL
26
26
 
27
27
  * Username `test`
28
28
  * Password `test`
29
- * Plugin `WP-API` is installed
30
- * Plugin `Basic-Auth` for `WP-API` installed
31
29
  * `.htaccess` for Pretty Permalinks is set up so the API works
32
30
 
33
31
  ## Developing the image
34
32
 
35
33
  ### Re-creating DB dump from scratch
36
34
 
37
- If you need to regenerate the DB dump, remove the part where the file is copied and restored from the `Dockerfile`, then build and start the image.
35
+ If you need to regenerate the DB dump, remove the part where the file is copied
36
+ and restored from the `Dockerfile`, then build and start the image.
38
37
 
39
38
  ```bash
40
- docker build -t wordpress_client_test:dev .
41
- docker run -it -p 8181:80 wordpress_client_test:dev
39
+ docker build -t hemnet/wordpress_client_test:dev .
40
+ docker run -it -p 8181:80 hemnet/wordpress_client_test:dev
42
41
  ```
43
42
 
44
- You'll get a `bash` shell inside the container. Open your browser and go to the newly booted application (`localhost:8181` if you have native Docker; otherwise go to your `DOCKER_HOST_IP:8181` URL – see `echo $DOCKER_HOST` in your local shell).
43
+ You'll get a `bash` shell inside the container. Open your browser and go to the
44
+ newly booted application ([`localhost:8181`](http://localhost:8181/)).
45
45
 
46
- You'll be greeted by the Wordpress installer. Fill in everything and complete the installation.
46
+ You'll be greeted by the Wordpress installer. Fill in everything and complete
47
+ the installation.
48
+
49
+ * Blog title `wordpress_client test`
50
+ * Username `test`
51
+ * Password `test`
52
+ * [Set up permalinks according to **Day and
53
+ name**!](http://localhost:8181/wp-admin/options-permalink.php)
54
+ * Without this the provided `.htaccess` will cause API requests to redirect.
55
+ * [Activate the Basic Auth plugin](http://localhost:8181/wp-admin/plugins.php)
47
56
 
48
57
  Then, **in your container's terminal**, run the following command:
49
58
 
50
59
  ```bash
51
- mysqldump -u "$MYSQL_USER" --password="$MYSQL_PASS" --host="$MYSQL_HOST" "$MYSQL_DB" | gzip -9 > /tmp/dbdump.sql.gz
60
+ mysqldump -u "$MYSQL_USER" --password="$MYSQL_PASS" --host="$MYSQL_HOST" "$MYSQL_DB" | \
61
+ gzip -9 > /tmp/dbdump.sql.gz
52
62
  ```
53
63
 
54
64
  You can then copy the file to your host using the `docker cp` command:
55
65
 
56
66
  ```bash
57
- docker ps | grep wordpress_client_test:dev
67
+ docker ps | grep hemnet/wordpress_client_test:dev
58
68
  # See the container ID or name of your running container
59
69
  docker cp THE-CONTAINER-ID:/tmp/dbdump.sql.gz .
60
70
  ```
Binary file
@@ -2,7 +2,7 @@
2
2
  service mysqld start
3
3
 
4
4
  gunzip -c /tmp/dbdump.sql.gz | \
5
- sed "s/192\.168\.99\.100:8181/${WORDPRESS_HOST:-localhost:8181}/g" | \
5
+ sed "s/localhost:8181/${WORDPRESS_HOST:-localhost:8181}/g" | \
6
6
  mysql \
7
7
  --user="$MYSQL_USER" \
8
8
  --password="$MYSQL_PASS" \
@@ -10,4 +10,4 @@ gunzip -c /tmp/dbdump.sql.gz | \
10
10
  --batch \
11
11
  "$MYSQL_DB"
12
12
 
13
- rm /tmp/dbdump.sql.gz
13
+ rm -rf /tmp/dbdump.sql.gz
@@ -1 +1,99 @@
1
- {"id":4,"date":null,"guid":{"rendered":"http:\/\/192.168.99.100:8181\/?p=4"},"modified":null,"modified_gmt":null,"slug":"","type":"post","link":"http:\/\/192.168.99.100:8181\/?p=4","title":{"rendered":"Metadata creation"},"content":{"rendered":""},"excerpt":{"rendered":""},"author":1,"featured_image":0,"comment_status":"open","ping_status":"open","sticky":false,"format":"standard","_links":{"self":[{"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/posts\/4"}],"collection":[{"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/posts"}],"author":[{"embeddable":true,"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/comments?post_id=4"}],"version-history":[{"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/posts\/4\/revisions"}],"https:\/\/api.w.org\/attachment":[{"embeddable":true,"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/media?post_parent=4"}],"https:\/\/api.w.org\/term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/posts\/4\/terms\/category"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/posts\/4\/terms\/tag"},{"taxonomy":"post_format","embeddable":true,"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/posts\/4\/terms\/post_format"}],"wp:meta":[{"embeddable":true,"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/posts\/4\/meta"}]},"_embedded":{"author":[{"avatar_urls":{"24":"http:\/\/2.gravatar.com\/avatar\/55502f40dc8b7c769880b10874abc9d0?s=24&d=mm&r=g","48":"http:\/\/2.gravatar.com\/avatar\/55502f40dc8b7c769880b10874abc9d0?s=48&d=mm&r=g","96":"http:\/\/2.gravatar.com\/avatar\/55502f40dc8b7c769880b10874abc9d0?s=96&d=mm&r=g"},"description":"","id":1,"link":"http:\/\/192.168.99.100:8181\/author\/test\/","name":"test","url":"","_links":{"self":[{"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/users\/1"}],"collection":[{"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/users"}]}}],"replies":[[{"id":1,"parent":0,"author":0,"author_name":"Mr WordPress","author_url":"https:\/\/wordpress.org\/","author_avatar_urls":{"24":"http:\/\/1.gravatar.com\/avatar\/?s=24&d=mm&r=g","48":"http:\/\/1.gravatar.com\/avatar\/?s=48&d=mm&r=g","96":"http:\/\/2.gravatar.com\/avatar\/?s=96&d=mm&r=g"},"date":"2015-11-03T07:47:41","content":{"rendered":"<p>Hi, this is a comment.<br \/>\nTo delete a comment, just log in and view the post&#039;s comments. There you will have the option to edit or delete them.<\/p>\n"},"link":"http:\/\/192.168.99.100:8181\/2015\/11\/03\/hello-world\/#comment-1","type":"comment","_links":{"self":[{"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/comments\/1"}],"collection":[{"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/comments"}],"up":[{"embeddable":true,"post_type":"post","href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/posts\/1"}]}}]],"https:\/\/api.w.org\/term":[[{"id":1,"link":"http:\/\/192.168.99.100:8181\/category\/uncategorized\/","name":"Uncategorized","slug":"uncategorized","taxonomy":"category","_links":{"self":[{"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/terms\/category\/1"}],"collection":[{"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/terms\/category"}]}}],[],[{"code":"rest_no_route","message":"No route was found matching the URL and request method","data":{"status":404}}]],"wp:meta":[[{"id":2,"key":"foo","value":"bar","_links":{"about":[{"embeddable":true,"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/posts\/4"}]}}]]}}
1
+ {
2
+ "id": 1,
3
+ "date": "2015-11-03T07:47:41",
4
+ "date_gmt": "2015-11-03T07:47:41",
5
+ "guid": {
6
+ "rendered": "http://localhost:8080/?p=1"
7
+ },
8
+ "modified": "2017-07-25T15:07:30",
9
+ "modified_gmt": "2017-07-25T15:07:30",
10
+ "slug": "hello-world",
11
+ "status": "publish",
12
+ "type": "post",
13
+ "link": "http://localhost:8080/2015/11/03/hello-world/",
14
+ "title": {
15
+ "rendered": "Hello world!"
16
+ },
17
+ "content": {
18
+ "rendered": "<p>Welcome to WordPress. This is your first post. Edit or delete it, then start writing!</p>\n",
19
+ "protected": false
20
+ },
21
+ "excerpt": {
22
+ "rendered": "<p>Welcome to WordPress. This is your first post. Edit or delete it, then start writing!</p>\n",
23
+ "protected": false
24
+ },
25
+ "author": 1,
26
+ "featured_media": 0,
27
+ "comment_status": "open",
28
+ "ping_status": "open",
29
+ "sticky": false,
30
+ "template": "",
31
+ "format": "standard",
32
+ "meta": {
33
+ "foo": 1,
34
+ "bar": true,
35
+ "baz": "wohoo"
36
+ },
37
+ "categories": [
38
+ 1
39
+ ],
40
+ "tags": [],
41
+ "_links": {
42
+ "self": [
43
+ {
44
+ "href": "http://localhost:8080/wp-json/wp/v2/posts/1"
45
+ }
46
+ ],
47
+ "collection": [
48
+ {
49
+ "href": "http://localhost:8080/wp-json/wp/v2/posts"
50
+ }
51
+ ],
52
+ "about": [
53
+ {
54
+ "href": "http://localhost:8080/wp-json/wp/v2/types/post"
55
+ }
56
+ ],
57
+ "author": [
58
+ {
59
+ "embeddable": true,
60
+ "href": "http://localhost:8080/wp-json/wp/v2/users/1"
61
+ }
62
+ ],
63
+ "replies": [
64
+ {
65
+ "embeddable": true,
66
+ "href": "http://localhost:8080/wp-json/wp/v2/comments?post=1"
67
+ }
68
+ ],
69
+ "version-history": [
70
+ {
71
+ "href": "http://localhost:8080/wp-json/wp/v2/posts/1/revisions"
72
+ }
73
+ ],
74
+ "wp:attachment": [
75
+ {
76
+ "href": "http://localhost:8080/wp-json/wp/v2/media?parent=1"
77
+ }
78
+ ],
79
+ "wp:term": [
80
+ {
81
+ "taxonomy": "category",
82
+ "embeddable": true,
83
+ "href": "http://localhost:8080/wp-json/wp/v2/categories?post=1"
84
+ },
85
+ {
86
+ "taxonomy": "post_tag",
87
+ "embeddable": true,
88
+ "href": "http://localhost:8080/wp-json/wp/v2/tags?post=1"
89
+ }
90
+ ],
91
+ "curies": [
92
+ {
93
+ "name": "wp",
94
+ "href": "https://api.w.org/{rel}",
95
+ "templated": true
96
+ }
97
+ ]
98
+ }
99
+ }
@@ -1 +1,324 @@
1
- {"id":1,"date":"2015-11-03T07:47:41","guid":{"rendered":"http:\/\/example.com\/?p=1"},"modified":"2015-11-17T09:18:22","modified_gmt":"2015-11-17T09:18:22","slug":"hello-world","type":"post","link":"http:\/\/example.com\/2015\/11\/03\/hello-world\/","title":{"rendered":"Hello world!"},"content":{"rendered":"<p>Welcome to WordPress. This is your first post. Edit or delete it, then start writing!<\/p>\n"},"excerpt":{"rendered":"<p>Welcome to WordPress. This is your first post. Edit or delete it, then start writing!<\/p>\n"},"author":1,"featured_image":0,"comment_status":"open","ping_status":"open","sticky":false,"format":"standard","_links":{"self":[{"href":"http:\/\/example.com\/wp-json\/wp\/v2\/posts\/1"}],"collection":[{"href":"http:\/\/example.com\/wp-json\/wp\/v2\/posts"}],"author":[{"embeddable":true,"href":"http:\/\/example.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/example.com\/wp-json\/wp\/v2\/comments?post_id=1"}],"version-history":[{"href":"http:\/\/example.com\/wp-json\/wp\/v2\/posts\/1\/revisions"}],"https:\/\/api.w.org\/attachment":[{"embeddable":true,"href":"http:\/\/example.com\/wp-json\/wp\/v2\/media?post_parent=1"}],"https:\/\/api.w.org\/term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/example.com\/wp-json\/wp\/v2\/posts\/1\/terms\/category"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/example.com\/wp-json\/wp\/v2\/posts\/1\/terms\/tag"},{"taxonomy":"post_format","embeddable":true,"href":"http:\/\/example.com\/wp-json\/wp\/v2\/posts\/1\/terms\/post_format"}],"https:\/\/api.w.org\/meta":[{"embeddable":true,"href":"http:\/\/example.com\/wp-json\/wp\/v2\/posts\/1\/meta"}]},"_embedded":{"author":[{"avatar_urls":{"24":"http:\/\/2.gravatar.com\/avatar\/55502f40dc8b7c769880b10874abc9d0?s=24&d=mm&r=g","48":"http:\/\/2.gravatar.com\/avatar\/55502f40dc8b7c769880b10874abc9d0?s=48&d=mm&r=g","96":"http:\/\/2.gravatar.com\/avatar\/55502f40dc8b7c769880b10874abc9d0?s=96&d=mm&r=g"},"description":"","id":1,"link":"http:\/\/example.com\/author\/test\/","name":"test","url":"","_links":{"self":[{"href":"http:\/\/example.com\/wp-json\/wp\/v2\/users\/1"}],"collection":[{"href":"http:\/\/example.com\/wp-json\/wp\/v2\/users"}]}}],"replies":[[{"id":1,"parent":0,"author":0,"author_name":"Mr WordPress","author_url":"http:\/\/wordpress.org\/","author_avatar_urls":{"24":"http:\/\/1.gravatar.com\/avatar\/?s=24&d=mm&r=g","48":"http:\/\/2.gravatar.com\/avatar\/?s=48&d=mm&r=g","96":"http:\/\/2.gravatar.com\/avatar\/?s=96&d=mm&r=g"},"date":"2015-11-03T07:47:41","content":{"rendered":"<p>Hi, this is a comment.<br \/>\nTo delete a comment, just log in and view the post&#039;s comments. There you will have the option to edit or delete them.<\/p>\n"},"link":"http:\/\/example.com\/2015\/11\/03\/hello-world\/#comment-1","type":"comment","_links":{"self":[{"href":"http:\/\/example.com\/wp-json\/wp\/v2\/comments\/1"}],"collection":[{"href":"http:\/\/example.com\/wp-json\/wp\/v2\/comments"}],"up":[{"embeddable":true,"post_type":"post","href":"http:\/\/example.com\/wp-json\/wp\/v2\/posts\/1"}]}}]],"https:\/\/api.w.org\/term":[[{"id":1,"link":"http:\/\/example.com\/category\/uncategorized\/","name":"Uncategorized","slug":"uncategorized","taxonomy":"category","_links":{"self":[{"href":"http:\/\/example.com\/wp-json\/wp\/v2\/terms\/category\/1"}],"collection":[{"href":"http:\/\/example.com\/wp-json\/wp\/v2\/terms\/category"}]}}],[{"id":2,"link":"http:\/\/example.com\/tag\/foo\/","name":"Foo","slug":"foo","taxonomy":"post_tag","_links":{"self":[{"href":"http:\/\/example.com\/wp-json\/wp\/v2\/terms\/tag\/2"}],"collection":[{"href":"http:\/\/example.com\/wp-json\/wp\/v2\/terms\/tag"}]}}],[{"code":"rest_no_route","message":"No route was found matching the URL and request method","data":{"status":404}}]],"https:\/\/api.w.org\/meta":[[{"id":3,"key":"Some test","value":"Definitely","_links":{"about":[{"embeddable":true,"href":"http:\/\/example.com\/wp-json\/wp\/posts\/1"}]}}]]}}
1
+ {
2
+ "id": 1,
3
+ "date": "2015-11-03T07:47:41",
4
+ "date_gmt": "2015-11-03T07:47:41",
5
+ "guid": {
6
+ "rendered": "http://example.com/?p=1"
7
+ },
8
+ "modified": "2017-07-31T13:26:39",
9
+ "modified_gmt": "2017-07-31T13:26:39",
10
+ "slug": "hello-world",
11
+ "status": "publish",
12
+ "type": "post",
13
+ "link": "http://example.com/2015/11/03/hello-world/",
14
+ "title": {
15
+ "rendered": "Hello world!"
16
+ },
17
+ "content": {
18
+ "rendered": "<p>Welcome to WordPress. This is your first post. Edit or delete it, then start writing!</p>\n",
19
+ "protected": false
20
+ },
21
+ "excerpt": {
22
+ "rendered": "<p>Welcome to WordPress. This is your first post. Edit or delete it, then start writing!</p>\n",
23
+ "protected": false
24
+ },
25
+ "author": 1,
26
+ "featured_media": 5,
27
+ "comment_status": "open",
28
+ "ping_status": "open",
29
+ "sticky": false,
30
+ "template": "",
31
+ "format": "standard",
32
+ "meta": {
33
+ "foo": 0,
34
+ "bar": false,
35
+ "baz": "helo world!"
36
+ },
37
+ "categories": [
38
+ 1
39
+ ],
40
+ "tags": [
41
+ 2
42
+ ],
43
+ "_links": {
44
+ "self": [
45
+ {
46
+ "href": "http://example.com/wp-json/wp/v2/posts/1"
47
+ }
48
+ ],
49
+ "collection": [
50
+ {
51
+ "href": "http://example.com/wp-json/wp/v2/posts"
52
+ }
53
+ ],
54
+ "about": [
55
+ {
56
+ "href": "http://example.com/wp-json/wp/v2/types/post"
57
+ }
58
+ ],
59
+ "author": [
60
+ {
61
+ "embeddable": true,
62
+ "href": "http://example.com/wp-json/wp/v2/users/1"
63
+ }
64
+ ],
65
+ "replies": [
66
+ {
67
+ "embeddable": true,
68
+ "href": "http://example.com/wp-json/wp/v2/comments?post=1"
69
+ }
70
+ ],
71
+ "version-history": [
72
+ {
73
+ "href": "http://example.com/wp-json/wp/v2/posts/1/revisions"
74
+ }
75
+ ],
76
+ "wp:featuredmedia": [
77
+ {
78
+ "embeddable": true,
79
+ "href": "http://example.com/wp-json/wp/v2/media/5"
80
+ }
81
+ ],
82
+ "wp:attachment": [
83
+ {
84
+ "href": "http://example.com/wp-json/wp/v2/media?parent=1"
85
+ }
86
+ ],
87
+ "wp:term": [
88
+ {
89
+ "taxonomy": "category",
90
+ "embeddable": true,
91
+ "href": "http://example.com/wp-json/wp/v2/categories?post=1"
92
+ },
93
+ {
94
+ "taxonomy": "post_tag",
95
+ "embeddable": true,
96
+ "href": "http://example.com/wp-json/wp/v2/tags?post=1"
97
+ }
98
+ ],
99
+ "curies": [
100
+ {
101
+ "name": "wp",
102
+ "href": "https://api.w.org/{rel}",
103
+ "templated": true
104
+ }
105
+ ]
106
+ },
107
+ "_embedded": {
108
+ "author": [
109
+ {
110
+ "id": 1,
111
+ "name": "test",
112
+ "url": "",
113
+ "description": "",
114
+ "link": "http://example.com/author/test/",
115
+ "slug": "test",
116
+ "avatar_urls": {
117
+ "24": "http://2.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0?s=24&d=mm&r=g",
118
+ "48": "http://2.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0?s=48&d=mm&r=g",
119
+ "96": "http://2.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0?s=96&d=mm&r=g"
120
+ },
121
+ "_links": {
122
+ "self": [
123
+ {
124
+ "href": "http://example.com/wp-json/wp/v2/users/1"
125
+ }
126
+ ],
127
+ "collection": [
128
+ {
129
+ "href": "http://example.com/wp-json/wp/v2/users"
130
+ }
131
+ ]
132
+ }
133
+ }
134
+ ],
135
+ "replies": [
136
+ [
137
+ {
138
+ "id": 1,
139
+ "parent": 0,
140
+ "author": 0,
141
+ "author_name": "Mr WordPress",
142
+ "author_url": "https://wordpress.org/",
143
+ "date": "2015-11-03T07:47:41",
144
+ "content": {
145
+ "rendered": "<p>Hi, this is a comment.<br />\nTo delete a comment, just log in and view the post&#039;s comments. There you will have the option to edit or delete them.</p>\n"
146
+ },
147
+ "link": "http://example.com/2015/11/03/hello-world/#comment-1",
148
+ "type": "comment",
149
+ "author_avatar_urls": {
150
+ "24": "http://0.gravatar.com/avatar/?s=24&d=mm&r=g",
151
+ "48": "http://1.gravatar.com/avatar/?s=48&d=mm&r=g",
152
+ "96": "http://2.gravatar.com/avatar/?s=96&d=mm&r=g"
153
+ },
154
+ "_links": {
155
+ "self": [
156
+ {
157
+ "href": "http://example.com/wp-json/wp/v2/comments/1"
158
+ }
159
+ ],
160
+ "collection": [
161
+ {
162
+ "href": "http://example.com/wp-json/wp/v2/comments"
163
+ }
164
+ ],
165
+ "up": [
166
+ {
167
+ "embeddable": true,
168
+ "post_type": "post",
169
+ "href": "http://example.com/wp-json/wp/v2/posts/1"
170
+ }
171
+ ]
172
+ }
173
+ }
174
+ ]
175
+ ],
176
+ "wp:featuredmedia": [
177
+ {
178
+ "id": 5,
179
+ "date": "2017-07-31T13:23:01",
180
+ "slug": "food-waffles-e1430873095640",
181
+ "type": "attachment",
182
+ "link": "http://example.com/2015/11/03/hello-world/food-waffles-e1430873095640/",
183
+ "title": {
184
+ "rendered": "food-waffles-e1430873095640"
185
+ },
186
+ "author": 1,
187
+ "caption": {
188
+ "rendered": ""
189
+ },
190
+ "alt_text": "",
191
+ "media_type": "image",
192
+ "mime_type": "image/png",
193
+ "media_details": {
194
+ "width": 128,
195
+ "height": 89,
196
+ "file": "2015/11/food-waffles-e1430873095640.png",
197
+ "image_meta": {
198
+ "aperture": "0",
199
+ "credit": "",
200
+ "camera": "",
201
+ "caption": "",
202
+ "created_timestamp": "0",
203
+ "copyright": "",
204
+ "focal_length": "0",
205
+ "iso": "0",
206
+ "shutter_speed": "0",
207
+ "title": "",
208
+ "orientation": "0",
209
+ "keywords": []
210
+ },
211
+ "sizes": {}
212
+ },
213
+ "source_url": "http://example.com/wp-content/uploads/2015/11/food-waffles-e1430873095640.png",
214
+ "_links": {
215
+ "self": [
216
+ {
217
+ "href": "http://example.com/wp-json/wp/v2/media/5"
218
+ }
219
+ ],
220
+ "collection": [
221
+ {
222
+ "href": "http://example.com/wp-json/wp/v2/media"
223
+ }
224
+ ],
225
+ "about": [
226
+ {
227
+ "href": "http://example.com/wp-json/wp/v2/types/attachment"
228
+ }
229
+ ],
230
+ "author": [
231
+ {
232
+ "embeddable": true,
233
+ "href": "http://example.com/wp-json/wp/v2/users/1"
234
+ }
235
+ ],
236
+ "replies": [
237
+ {
238
+ "embeddable": true,
239
+ "href": "http://example.com/wp-json/wp/v2/comments?post=5"
240
+ }
241
+ ]
242
+ }
243
+ }
244
+ ],
245
+ "wp:term": [
246
+ [
247
+ {
248
+ "id": 1,
249
+ "link": "http://example.com/category/uncategorized/",
250
+ "name": "Uncategorized",
251
+ "slug": "uncategorized",
252
+ "taxonomy": "category",
253
+ "_links": {
254
+ "self": [
255
+ {
256
+ "href": "http://example.com/wp-json/wp/v2/categories/1"
257
+ }
258
+ ],
259
+ "collection": [
260
+ {
261
+ "href": "http://example.com/wp-json/wp/v2/categories"
262
+ }
263
+ ],
264
+ "about": [
265
+ {
266
+ "href": "http://example.com/wp-json/wp/v2/taxonomies/category"
267
+ }
268
+ ],
269
+ "wp:post_type": [
270
+ {
271
+ "href": "http://example.com/wp-json/wp/v2/posts?categories=1"
272
+ }
273
+ ],
274
+ "curies": [
275
+ {
276
+ "name": "wp",
277
+ "href": "https://api.w.org/{rel}",
278
+ "templated": true
279
+ }
280
+ ]
281
+ }
282
+ }
283
+ ],
284
+ [
285
+ {
286
+ "id": 2,
287
+ "link": "http://example.com/tag/winamp/",
288
+ "name": "winamp",
289
+ "slug": "winamp",
290
+ "taxonomy": "post_tag",
291
+ "_links": {
292
+ "self": [
293
+ {
294
+ "href": "http://example.com/wp-json/wp/v2/tags/2"
295
+ }
296
+ ],
297
+ "collection": [
298
+ {
299
+ "href": "http://example.com/wp-json/wp/v2/tags"
300
+ }
301
+ ],
302
+ "about": [
303
+ {
304
+ "href": "http://example.com/wp-json/wp/v2/taxonomies/post_tag"
305
+ }
306
+ ],
307
+ "wp:post_type": [
308
+ {
309
+ "href": "http://example.com/wp-json/wp/v2/posts?tags=2"
310
+ }
311
+ ],
312
+ "curies": [
313
+ {
314
+ "name": "wp",
315
+ "href": "https://api.w.org/{rel}",
316
+ "templated": true
317
+ }
318
+ ]
319
+ }
320
+ }
321
+ ]
322
+ ]
323
+ }
324
+ }