Craigs Portfolio

7. CRUD – Read

POSTMAN GET - Read

The GET HTTP request is the simplest of the CRUD functionality when using the WP Rest API.  This is due to it not modifying any data.  The GET request is composed of the response body and headers.

No authentication is required to read data from the server which is why it is one of the simplest methods. This GET method with the route /wp-json/wp/v2/posts shows a list of all posts on the server dwt.uniwebsitedevelopment.esy.es which using Postman outputs the data into different formats and views.  The view below is Pretty JSON format so it is more readable.

The screenshot shows the Status is 200  OK which means the request is successful and has returned data as shown.  It took 338ms to make the request.  The website is hosted on a testing server so higher response times are expected.  There are 3 posts in total on the server which are being requested.  The first post listed has an ID of 183 so by going to the route /wp-json/wp/v2/posts/183 in the GET request this will display only that post requested.

I can pass arguments in the request to show me the posts that are created by author id 1 and categories id 28 which are taken from the JSON arguments from the GET request.  This does return the same 3 posts as they were created by the same user with the same category.  This argument would be more handy for showing archive posts by a particular user or/and a particular category.  To see all arguments available, this can be done by sending the route /wp-json/wp/v2/posts as an OPTIONS request.

Space background with blue and red nebula
Dynamic Web Technologies

12. Demo Feedback

522 Error on OMDB Following the 522 error I was getting on the OMDB when searching, I tested the test data on the OMDB website

Read More »
Dynamic Web Technologies

11. Conclusion

Conclusion Prior to Dynamic Web Technologies course I wasn’t interested in JSON and no idea what AJAX even was.  Whenever JSON or AJAX comes up

Read More »
Dynamic Web Technologies

10. CRUD – jQuery

Read – jQuery For jQuery consumption of the WordPress Rest API, I am using Bootstrap framework offline. I have created a quick Bootstrap layout and

Read More »