WordPress REST API Basics

  Рет қаралды 89,105

Chris Miller

Chris Miller

Күн бұрын

Пікірлер: 73
@mediawijsheid952
@mediawijsheid952 2 жыл бұрын
Thanks for the video! Didn't understand this in class and now I got it in 5 minutes. I'll use this to help the other students too. :)
@millertchris
@millertchris 2 жыл бұрын
Glad to hear it; you're welcome!
@DragonatorTrends
@DragonatorTrends 2 ай бұрын
ATTENTION I GET ERROR: { "code": "rest_no_route", "message": "No route was found matching the URL and request method.", "data": { "status": 404 } }
@camilogarcia1325
@camilogarcia1325 2 жыл бұрын
How to get products info on external API and post them into woocommerce via postman or a code that refresh it continuously?
@millertchris
@millertchris 2 жыл бұрын
There are several ways to get product information from an external API and post it to WooCommerce using Postman or code: Using Postman: First, you will need to make a GET request to the external API to retrieve the product information. Then, you can use the WooCommerce API endpoints to create a new product or update an existing product in your WooCommerce store. You can use the WooCommerce API documentation to learn about the endpoints and the required data for creating or updating a product. You can also use Postman's collection feature to save and organize your requests for easy access. Using code: You can use a programming language such as PHP to fetch the product information from the external API using a GET request. Then, you can use the WooCommerce API library for the language you're using to make requests to the WooCommerce API. You can use the WooCommerce API documentation to learn about the endpoints and the required data for creating or updating a product. You can also use a cronjob or a scheduled task to refresh the products information continuously. It is also important to note that you will need to have the WooCommerce REST API enabled and the appropriate authentication credentials (such as API keys) in order to access the WooCommerce API. Also, you will need to check the external API documentation to see if they have any rate limiting or usage restrictions, so you can plan accordingly.
@camilogarcia1325
@camilogarcia1325 2 жыл бұрын
@@millertchris Thank you very much
@chrisder1814
@chrisder1814 6 ай бұрын
hello I had ideas but I don't know if I could realize them thanks to the APIs and applications that I use could you tell me what you think about it
@SD-rg5mj
@SD-rg5mj 6 ай бұрын
hello I was wondering a question regarding the API for SEO Thanks to the API I can do SEO automatically, I mean there are tools like rank math but if I understand correctly I cannot automate it, I mean I have I understood that to use it I must be connected to my back end and scan the pages one by one then I must change the keywords one by one? on the other hand I was wondering if there wouldn't be a site to which I could give the URL of my site and that it would automatically scan all the pages and replace all the bad keywords with good ones? if this is not possible then I asked myself if I will not be able to develop a chrome or WordPress plugin? I'm not a developer at all but I've seen tutorials where it's explained that it's as simple as a prompt and finally the last option is I thought maybe I could do it with a make scenario?
@chrisder1814
@chrisder1814 5 ай бұрын
hello, can I use it with the g.sheet api connector module?
@edanbenatar
@edanbenatar Жыл бұрын
Great video! Love the simplicity and concise approach 🔥
@millertchris
@millertchris Жыл бұрын
Thanks, Edan! We need to catch up soon.
@stevenokanda7652
@stevenokanda7652 2 жыл бұрын
amaizing video got me started on the API can't wait to do something amazing with it
@millertchris
@millertchris Жыл бұрын
Best of luck!
@antdx316
@antdx316 2 жыл бұрын
What is the point of GET API? Is it to query that data and have only that shown somewhere else?
@millertchris
@millertchris 2 жыл бұрын
Exactly! You could use it in a JS application, mobile app, or anything else that can consume JSON.
@antdx316
@antdx316 2 жыл бұрын
@@millertchrisis it just good for posts? what else would it be great for making it worth doing wise?
@briansanchez7751
@briansanchez7751 Жыл бұрын
@@antdx316 for example a sports page, you want to be able to query the data of stats by player or teams, leagues etc.
@antdx316
@antdx316 Жыл бұрын
@@briansanchez7751 I've been coding like nuts for weeks with ChatGPT : )
@arunkaul5008
@arunkaul5008 Жыл бұрын
hello Chris Miller how can i get form entries data, what is the api for that
@harshparmanandani4195
@harshparmanandani4195 3 ай бұрын
Hi it shows an error to me {"code":"rest_no_route","message":"No route was found matching the URL and request method.","data":{"status":404}}
@harounaken358
@harounaken358 2 жыл бұрын
Hi! I am using a learnpress rest API via wordpress and its very slow on my app. I read that its because wordpress tries to load all plugins (which I have several) when the rest api is called. Is there a way to solve this please? for learnpress?
@millertchris
@millertchris 2 жыл бұрын
Yes, there are a few ways to improve the performance of a WordPress REST API endpoint that is slow due to plugin loading. One solution is to use the "rest_authentication_errors" filter to limit the plugins that load when a REST API request is made. This can be done by checking the current request and only loading the necessary plugins for that request. Another solution is to use caching plugins such as WP Fastest Cache or W3 Total Cache to cache the REST API responses. This can greatly improve the performance of the API, especially for frequently requested endpoints. You can also try using a plugin like "Disable REST API" or "WP REST Cache" to disable the REST API for certain routes or pages where it's not needed. It is also important to note that the LearnPress plugin has some caching options that can be enabled. You can check its documentation to see if they can help with your case. It's also worth noting that the performance of your API can also be affected by the hosting environment, so you might also want to consider upgrading your server resources.
@georgenessem2351
@georgenessem2351 2 жыл бұрын
I need to upload image to can use it in the posts
@millertchris
@millertchris 2 жыл бұрын
Can you elaborate?
@alimosbah
@alimosbah 2 жыл бұрын
Is there a way to protect a custom Rest API especially when POST Request
@millertchris
@millertchris 2 жыл бұрын
Yes, there are several ways to protect a custom REST API endpoint in WordPress, especially when handling sensitive data such as a POST request. Some common methods include: Authentication: Requiring a valid nonce or credentials for every request to the API. WordPress have its own authentication methods like JWT Authentication for WP-API plugin which allows you to secure your endpoints. Authorization: Checking if the user has the appropriate permissions to access the endpoint. WordPress has built-in capability system which can be used to assign capability to user roles. Input validation: Validating user input to ensure it meets certain criteria, such as the right format, length, or allowed characters. WordPress has built-in functions for validation like wp_verify_nonce() which can be used to validate nonce. Request rate limiting: Limiting the number of requests that can be made in a certain period of time to prevent overloading the server. This can be achieved by using plugin like "Limit Login Attempts Reloaded" SSL/TLS encryption: Encrypting all data exchanged between the client and the server to protect against eavesdropping and tampering. WordPress has built-in functions to handle SSL like is_ssl(). Using an API Gateway: An API Gateway acts as a reverse proxy and can handle many of the above security concerns, such as authentication and rate limiting. WordPress doesn't have built-in support for API gateway, but you can use plugins like "WooCommerce REST API Manager" to achieve this. It's important to note that these are some of the most common ways to secure an API in WordPress, but depending on the specific requirements of the API, other methods may need to be added.
@ariyibimoses6127
@ariyibimoses6127 2 жыл бұрын
Is it possible we use api to dropship from hrkgaming to my wordpress website?
@millertchris
@millertchris 2 жыл бұрын
Yes, it is possible to use an API to dropship from a supplier like HRK Gaming to your WordPress website. There are a few different ways to do this, depending on the specific requirements of your website and the capabilities of the supplier's API. One way is to use a plugin like "Aliexpress Dropshipping" or "Ebay Dropshipping" that connects to the supplier's API and automatically imports products from HRK Gaming to your website. These plugins will typically handle the process of pulling in product information, pricing, and inventory levels from the supplier's API, so you don't have to do it manually. Another way is to create custom code that uses the supplier's API to pull in product information and create new products on your website. This will require more development work, but it can give you more control over the process and allows you to customize the way products are imported. You will need to check if HRK gaming provides a public API that you can use, and also check their terms and conditions to ensure that you are allowed to use the API for your business. It's also worth noting that dropshipping can be complex and time consuming process, so it's recommended to have a good understanding of the process before you start implementing it.
@ariyibimoses6127
@ariyibimoses6127 2 жыл бұрын
Thank you
@chainedereve8180
@chainedereve8180 Жыл бұрын
Great, but what is the purpose of these rest api ? What can be done with them, add or delete articles ?
@Shagunsingh-c2f
@Shagunsingh-c2f Жыл бұрын
we donot require client Id and client secret in postman to authenticate wordpress
@doctortravis
@doctortravis 4 ай бұрын
Well damn! That was easy to understand. Thank you!
@antaljani
@antaljani 2 жыл бұрын
What is the SW used for playing around APIs? I was not able to recognize it.
@millertchris
@millertchris 2 жыл бұрын
You could use Postman - there are several more out there.
@tomwallace6250
@tomwallace6250 11 ай бұрын
So since we can do this …. Is there a point to using GraphQL?
@jayks777
@jayks777 2 жыл бұрын
I’m really new to APIs. How did you set up the “local” account? Is that on Wordpress?
@millertchris
@millertchris 2 жыл бұрын
Yes! That was setup using the Local WP application for testing purposes. You can check out some of my others videos to learn more about Local WP.
@nav3961
@nav3961 2 жыл бұрын
Sir, i have a question regarding wordpress. How to publish a manual article post to wordpress automatically?? (If we have huge content of post )
@millertchris
@millertchris 2 жыл бұрын
Could you elaborate more?
@davidjackson148
@davidjackson148 2 жыл бұрын
Hmmm. I only get one post and is seems like the default one :(
@davidjackson148
@davidjackson148 2 жыл бұрын
Fixed with a WordPress upgrade to 6.1.1, no idea what the problem was but hey ho.
@millertchris
@millertchris 2 жыл бұрын
Glad I could help!
@LDT7Y
@LDT7Y 2 жыл бұрын
I've watched so many tutorials, but still can't find an answer for this. I can send data from my game to webpages in json format. The webpage I want to post to is on wordpress and has a basic form with two fields. I want to use json to enter data into those fields and submit the form (click on the button). How would I do this for a wordpress form? I can't find any examples.
@millertchris
@millertchris 2 жыл бұрын
Why post to a form instead of submitting a post request to the API endpoint?
@LDT7Y
@LDT7Y 2 жыл бұрын
@@millertchris What do you mean? Sorry, I'm really new to this stuff.
@pellravi338
@pellravi338 2 жыл бұрын
How to authenticate get api...not visible to public
@millertchris
@millertchris 2 жыл бұрын
There are several ways to authenticate a GET API so that it is not visible to the public: Token-based authentication: This method uses tokens to authenticate users. The client sends a request with a token, and the server verifies the token before processing the request. This can be done using a library like JWT (JSON Web Tokens). Basic authentication: This method uses a combination of a username and password to authenticate the user. The client sends the credentials in the request header, and the server verifies them before processing the request. OAuth 2.0: This is an open-standard for authorization. It allows third-party applications to obtain limited access to a web service. API Key-based authentication: This method uses a unique key to identify the client and authenticate the request. The key is passed in the request header or as a query parameter, and the server verifies it before processing the request. IP Whitelisting: This method only allows requests from a specific IP address or range of IP addresses. It is also important to note that you should always use HTTPS for secure communication, and keep the API documentation and authentication methods private. Additionally, you should also monitor and log API requests for security and auditing purposes.
@zeesh8394
@zeesh8394 2 жыл бұрын
Have a question where can I ask this?
@millertchris
@millertchris 2 жыл бұрын
You can ask here!
@KentaroxKondo
@KentaroxKondo Жыл бұрын
This is super helpful. Thank you, Chris!
@NareshBabu
@NareshBabu 3 жыл бұрын
This is new to me, thanks Chris!
@millertchris
@millertchris 3 жыл бұрын
My pleasure!
@bluetheredpanda
@bluetheredpanda Жыл бұрын
Hey Chris! Thanks for the video, it's my first time manipulating the REST API on a WP site, as well as using Postman, and the knowledge you're sharing here came in very handy! ❤ Quick question out of curiosity: in the video, it seemed like you're accessing the REST API of a local WordPress website (based on the ".local" TLD and the lack of SSL certificate) from Postman. If that's correct, how did you manage that? Thanks 🙏
@visualmodo
@visualmodo 2 жыл бұрын
Very good video!
@millertchris
@millertchris 2 жыл бұрын
Glad you liked it!
@martinkaspar5095
@martinkaspar5095 2 жыл бұрын
Hello dear Chris - Brilliant clip - thanks. your videos are a great resource:. Would you do some vids about the new Version 6.1 That would be awesome!
@millertchris
@millertchris 2 жыл бұрын
Sure thing! I've been taking a break, but when I return, I'll add it to the list.
@martinkaspar5095
@martinkaspar5095 2 жыл бұрын
@@millertchris awesome - this is so great. Keep up your great project: it rocks!!!
@millertchris
@millertchris 2 жыл бұрын
@@martinkaspar5095 thank you!
@harshmakwanaa
@harshmakwanaa Жыл бұрын
getting the 404 not found
@King-hs9zc
@King-hs9zc Жыл бұрын
ive been getting the same error have you been able to figure out what could be the cause?
@harshmakwanaa
@harshmakwanaa Жыл бұрын
@@King-hs9zc i was using the official wp site for creation than I saw some videos and all pf them are making wp locally using local wp i did the same and it worked
@farhantaqi2907
@farhantaqi2907 2 жыл бұрын
This was good for ppl who are new to WordPress apis but since you reply which is great so I would like to put across this question which am unable to figure out since long now :) I am using a plugin that has some custom post types, and the api response is like too much which I do not want but I just can't figure out how to use _field to return me the meta values, it just keeps returning meta key as empty :/
@millertchris
@millertchris 2 жыл бұрын
This is a bit hard to wrap my head around without visuals. Can you DM me on Twitter a screenshot?
@HimasRafeek
@HimasRafeek 2 жыл бұрын
Can you please make a tutorial on how to make a crud app with Js using WP REST Api?
@millertchris
@millertchris 2 жыл бұрын
Absolutely! Not sure when, but hopefully I'll put something out by the end of this summer.
@michaelbelete2124
@michaelbelete2124 Жыл бұрын
Amazing!!
@HerlindaRodriguez-z9f
@HerlindaRodriguez-z9f 4 ай бұрын
Daren Lodge
@Johnello1
@Johnello1 2 жыл бұрын
Do you guys know any methods of testing WP plugins using rest API? What tools to use etc...a tutorial that shows you the benefits of rest would be helpful as well...thanks
@millertchris
@millertchris 2 жыл бұрын
Yes! There are several methods of testing WordPress plugins using the REST API. One way is to use a tool like HTTPie, Postman, or Insomnia to send HTTP requests to the plugin's endpoints and analyze the responses. These tools allow you to easily test different request methods (e.g. GET, POST, PUT, DELETE) and inspect the returned data. A tutorial that demonstrates the benefits of using the REST API for plugin development could include information on how to interact with the API using these tools, as well as best practices for designing and implementing endpoints in a plugin. I'll definitely consider create another video about this in the future.
@Johnello1
@Johnello1 2 жыл бұрын
Thanks Chris !
@Prabh_cc
@Prabh_cc 3 ай бұрын
peace of waste
WordPress REST API Authentication: Application Passwords
14:34
LearnWebCode
Рет қаралды 57 М.
What is a REST API?
9:12
IBM Technology
Рет қаралды 1,6 МЛН
99.9% IMPOSSIBLE
00:24
STORROR
Рет қаралды 31 МЛН
How Strong Is Tape?
00:24
Stokes Twins
Рет қаралды 96 МЛН
WordPress REST API - custom routes and endpoints
17:20
WordPress
Рет қаралды 10 М.
The WordPress REST API
7:03
WordPress
Рет қаралды 3,8 М.
WP REST API - Custom Endpoints
14:00
Watch and Learn
Рет қаралды 80 М.
Using the WordPress REST API
13:24
WordPress
Рет қаралды 32 М.
Apprendre à utiliser l'API Rest de WordPress facilement !
13:10
Exploring The Wordpress REST API & React Integration
51:32
Traversy Media
Рет қаралды 202 М.
STOP using WordPress in 2024! (6 Best Alternatives)
16:58
ODi Productions
Рет қаралды 947 М.
99.9% IMPOSSIBLE
00:24
STORROR
Рет қаралды 31 МЛН