{"id":3520,"date":"2020-01-30T09:52:21","date_gmt":"2020-01-30T08:52:21","guid":{"rendered":"https:\/\/2020.geneve.wordcamp.org\/?post_type=wcb_session&#038;p=3520"},"modified":"2020-03-10T04:38:58","modified_gmt":"2020-03-10T03:38:58","slug":"wordpress-rest-api-and-ajax","status":"publish","type":"wcb_session","link":"https:\/\/geneve.wordcamp.org\/2020\/session\/wordpress-rest-api-and-ajax\/","title":{"rendered":"WordPress REST API and AJAX"},"content":{"rendered":"\n<p>The WP REST API enables WordPress content and functionality to be used with AJAX, thus enabling code to be executed without a page refresh in WordPress or in Decoupled WordPress sites.<\/p>\n\n\n\n<p>The workshop is a step by step set of progressive code tutorials that you can work with and keep that culminate in an AJAX form that posts data to a custom WP REST API endpoint that we will have created, which also has WP-NONCE verification as well.<\/p>\n\n\n\n<p>Using the WP Rest API and AJAX, attendees will learn how to create WordPress Single Page Applications as well as &nbsp;Decoupled WordPress sites to run on PHP or HTML pages.<\/p>\n\n\n\n<p>The workshop has minimal JavaScript and JSON knowledge which will be explained as needed.<\/p>\n\n\n\n<p>In this workshop we will look at:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>What an API is and what makes it RESTful?<\/li><li>How to get and display content using the built in WP REST API.<\/li><li>How to create and validate JSON Web Tokens for authentication.<\/li><li>How to create our own endpoints in the WP REST API for both GET and POST requests.<\/li><li>How to create custom REST APIs using page-[slug].php<\/li><li>Create some WP pages that GET content, search content and POST form data with the added security check of using WP-NONCES.<\/li><\/ul>\n\n\n\n<p>To make the most of this workshop it would be good to have a code editor, local web server or a code editor with \u2018live-server\u2019. &nbsp;Additional resources will be available to take away for later use.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The WP REST API enables WordPress content and functionality to be used with AJAX, thus enabling code to be executed without a page refresh in WordPress or in Decoupled WordPress sites. The workshop is a step by step set of progressive code tutorials that you can work with and keep that culminate in an AJAX &hellip; <a href=\"https:\/\/geneve.wordcamp.org\/2020\/session\/wordpress-rest-api-and-ajax\/\" class=\"more-link\">Lire la suite de<span class=\"screen-reader-text\"> \u00ab\u00a0WordPress REST API and AJAX\u00a0\u00bb<\/span><\/a><\/p>\n","protected":false},"author":15819979,"featured_media":0,"template":"","meta":{"jetpack_post_was_ever_published":false,"_wcpt_session_time":1602319500,"_wcpt_session_duration":3600,"_wcpt_session_type":"session","_wcpt_session_slides":"","_wcpt_session_video":"","_wcpt_speaker_id":[3351],"footnotes":""},"session_track":[256],"session_category":[254],"class_list":["post-3520","wcb_session","type-wcb_session","status-publish","hentry","wcb_track-petite-salle-small-room","wcb_session_category-atelier-workshop"],"jetpack_sharing_enabled":true,"session_date_time":{"date":"10.10.2020","time":"10:45"},"session_speakers":[{"id":"3351","slug":"craig-west","name":"Craig West","link":"https:\/\/geneve.wordcamp.org\/2020\/speaker\/craig-west\/"}],"session_cats_rendered":"Atelier \/ Workshop","_links":{"self":[{"href":"https:\/\/geneve.wordcamp.org\/2020\/wp-json\/wp\/v2\/sessions\/3520","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/geneve.wordcamp.org\/2020\/wp-json\/wp\/v2\/sessions"}],"about":[{"href":"https:\/\/geneve.wordcamp.org\/2020\/wp-json\/wp\/v2\/types\/wcb_session"}],"version-history":[{"count":4,"href":"https:\/\/geneve.wordcamp.org\/2020\/wp-json\/wp\/v2\/sessions\/3520\/revisions"}],"predecessor-version":[{"id":3977,"href":"https:\/\/geneve.wordcamp.org\/2020\/wp-json\/wp\/v2\/sessions\/3520\/revisions\/3977"}],"speakers":[{"embeddable":true,"href":"https:\/\/geneve.wordcamp.org\/2020\/wp-json\/wp\/v2\/speakers\/3351"}],"author":[{"embeddable":true,"href":"https:\/\/geneve.wordcamp.org\/2020\/wp-json\/wporg\/v1\/users\/craigwestwpbtn"}],"wp:attachment":[{"href":"https:\/\/geneve.wordcamp.org\/2020\/wp-json\/wp\/v2\/media?parent=3520"}],"wp:term":[{"taxonomy":"wcb_track","embeddable":true,"href":"https:\/\/geneve.wordcamp.org\/2020\/wp-json\/wp\/v2\/session_track?post=3520"},{"taxonomy":"wcb_session_category","embeddable":true,"href":"https:\/\/geneve.wordcamp.org\/2020\/wp-json\/wp\/v2\/session_category?post=3520"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}