Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create product rest endpoints #5

Open
louwie17 opened this issue Dec 15, 2021 · 0 comments
Open

Create product rest endpoints #5

louwie17 opened this issue Dec 15, 2021 · 0 comments

Comments

@louwie17
Copy link
Owner

We should persist the product data on the server by using a REST api.
Endpoints that we would want:

  • get all products (GET)
  • create new product (POST)

Example of a rest endpoint call: http://localhost:8888/index.php?rest_route=/store/v1/products
For now we can use get_option and update_option to persist the data.

Here is some documentation for creating a new REST route: https://developer.wordpress.org/rest-api/extending-the-rest-api/adding-custom-endpoints

We should follow the controller pattern as described here:
https://developer.wordpress.org/rest-api/extending-the-rest-api/adding-custom-endpoints/#the-controller-pattern

These endpoints can be public. Something like Postman would be helpful to test the API endpoints.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant