GravityPDF / gravity-pdf

Gravity PDF is the ultimate third-party PDF automation tool for generating digital PDFs using the popular form-builder plugin Gravity Forms.
https://gravitypdf.com
89 stars 20 forks source link

Refractor all AJAX calls to WP Rest API Calls #886

Open jakejackson1 opened 5 years ago

jakejackson1 commented 5 years ago

Besides being less overhead per AJAX call, there's less overhead unit testing REST API requests than there is testing AJAX requests, which will speed up the time it takes our automated tests to run.

I recommend first familiarising yourself with the WordPress REST API as well as the WordPress AJAX API.

The REST API will need to be carefully planned, and should get its own namespace / folder structure under /src/Api/. The root Gravity PDF API endpoint should be gravity-pdf/v1. Before you write any code, I'd like to see a report / plan of all the current AJAX functionality in Gravity PDF / what it's used for, as well as the proposed REST API endpoints (url and method - GET/POST/PUT/DELETE) and folder structure.

When it comes time to upgrade the existing JS, you can get @debbieellis7 to assist.

If you'd like further inspiration on how I've built our REST API components in the past, see the files in https://github.com/GravityPDF/gravity-pdf-previewer/tree/development/src/API

jakejackson1 commented 5 years ago

Planning document https://docs.google.com/spreadsheets/d/1wn20vvPv9fIJhnGi5Y5R1GwI2FvERgDRsJli2stLj1c/edit?usp=sharing