Craigs Portfolio

8. CRUD – Create

POSTMAN POST - Create

This Create is not as simple as the GET request as it requires authentication, as does the Update and Delete methods.  As shown below:

Creating a post is as simple as below after there is authentication.  Sending the below data to the server will create the post.

Using JSON Basic Authentication Plugin with WordPress from Github found here https://github.com/WP-API/Basic-Auth, I am able to authenticate via my user/pass to give access to Create/Update/Delete.

I have blacked out the username/password data in the screenshot, mainly because I don’t want to give out the username or the amount of characters for the password.  Upon submitting the above screenshot it has now created the post as shown below:

The problem with this however, is there is no option for images so there is no featured image attached which allows the users to create a post with the featured image.  This can also be added by using the WP Rest API to add an image to the route /wp-json/wp/v2/media.  This allows the developer to select form-data and file from the key value pair to add an image to the media library. 

The above image is Posted into the media library but it does not attach the media image to the post.  I would need to edit the post to be able to do this so I will do this with the Update section.

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 »