WordPress REST API Basics

  Рет қаралды 76,930

Chris Miller

Chris Miller

2 жыл бұрын

In this video - you'll learn how WordPress core comes with a REST API and how to use Postman to send a request and get a response.
Reference WordPress REST API Handbook
developer.wordpress.org/rest-...

Пікірлер: 66
@mediawijsheid952
@mediawijsheid952 Жыл бұрын
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 Жыл бұрын
Glad to hear it; you're welcome!
@KentaroxKondo
@KentaroxKondo Жыл бұрын
This is super helpful. Thank you, Chris!
@edanbenatar
@edanbenatar Жыл бұрын
Great video! Love the simplicity and concise approach 🔥
@millertchris
@millertchris Жыл бұрын
Thanks, Edan! We need to catch up soon.
@NareshBabu
@NareshBabu 2 жыл бұрын
This is new to me, thanks Chris!
@millertchris
@millertchris 2 жыл бұрын
My pleasure!
@stevenokanda7652
@stevenokanda7652 Жыл бұрын
amaizing video got me started on the API can't wait to do something amazing with it
@millertchris
@millertchris Жыл бұрын
Best of luck!
@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 🙏
@chrisder1814
@chrisder1814 10 күн бұрын
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
@visualmodo
@visualmodo 2 жыл бұрын
Very good video!
@millertchris
@millertchris 2 жыл бұрын
Glad you liked it!
@SD-rg5mj
@SD-rg5mj 5 күн бұрын
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?
@martinkaspar5095
@martinkaspar5095 Жыл бұрын
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 Жыл бұрын
Sure thing! I've been taking a break, but when I return, I'll add it to the list.
@martinkaspar5095
@martinkaspar5095 Жыл бұрын
@@millertchris awesome - this is so great. Keep up your great project: it rocks!!!
@millertchris
@millertchris Жыл бұрын
@@martinkaspar5095 thank you!
@arunkaul5008
@arunkaul5008 Жыл бұрын
hello Chris Miller how can i get form entries data, what is the api for that
@michaelbelete2124
@michaelbelete2124 Жыл бұрын
Amazing!!
@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.
@camilogarcia1325
@camilogarcia1325 Жыл бұрын
How to get products info on external API and post them into woocommerce via postman or a code that refresh it continuously?
@millertchris
@millertchris Жыл бұрын
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 Жыл бұрын
@@millertchris Thank you very much
@chainedereve8180
@chainedereve8180 Жыл бұрын
Great, but what is the purpose of these rest api ? What can be done with them, add or delete articles ?
@harounaken358
@harounaken358 Жыл бұрын
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 Жыл бұрын
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.
@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.
@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 Жыл бұрын
This is a bit hard to wrap my head around without visuals. Can you DM me on Twitter a screenshot?
@nav3961
@nav3961 Жыл бұрын
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 Жыл бұрын
Could you elaborate more?
@LDT7Y
@LDT7Y Жыл бұрын
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 Жыл бұрын
Why post to a form instead of submitting a post request to the API endpoint?
@LDT7Y
@LDT7Y Жыл бұрын
@@millertchris What do you mean? Sorry, I'm really new to this stuff.
@user-xo8rz1fi5h
@user-xo8rz1fi5h Жыл бұрын
we donot require client Id and client secret in postman to authenticate wordpress
@georgenessem2351
@georgenessem2351 2 жыл бұрын
I need to upload image to can use it in the posts
@millertchris
@millertchris Жыл бұрын
Can you elaborate?
@ariyibimoses6127
@ariyibimoses6127 Жыл бұрын
Is it possible we use api to dropship from hrkgaming to my wordpress website?
@millertchris
@millertchris Жыл бұрын
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 Жыл бұрын
Thank you
@tomwallace6250
@tomwallace6250 5 ай бұрын
So since we can do this …. Is there a point to using GraphQL?
@zeesh8394
@zeesh8394 Жыл бұрын
Have a question where can I ask this?
@millertchris
@millertchris Жыл бұрын
You can ask here!
@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.
@antdx316
@antdx316 Жыл бұрын
What is the point of GET API? Is it to query that data and have only that shown somewhere else?
@millertchris
@millertchris Жыл бұрын
Exactly! You could use it in a JS application, mobile app, or anything else that can consume JSON.
@antdx316
@antdx316 Жыл бұрын
@@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 : )
@davidjackson148
@davidjackson148 Жыл бұрын
Hmmm. I only get one post and is seems like the default one :(
@davidjackson148
@davidjackson148 Жыл бұрын
Fixed with a WordPress upgrade to 6.1.1, no idea what the problem was but hey ho.
@millertchris
@millertchris Жыл бұрын
Glad I could help!
@pellravi338
@pellravi338 Жыл бұрын
How to authenticate get api...not visible to public
@millertchris
@millertchris Жыл бұрын
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.
@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
@h1ghpower
@h1ghpower Жыл бұрын
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 Жыл бұрын
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.
@h1ghpower
@h1ghpower Жыл бұрын
Thanks Chris !
@alimosbah
@alimosbah Жыл бұрын
Is there a way to protect a custom Rest API especially when POST Request
@millertchris
@millertchris Жыл бұрын
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.
WordPress REST API Authentication: Application Passwords
14:34
LearnWebCode
Рет қаралды 52 М.
Эффект Карбонаро и нестандартная коробка
01:00
История одного вокалиста
Рет қаралды 9 МЛН
Clowns abuse children#Short #Officer Rabbit #angel
00:51
兔子警官
Рет қаралды 76 МЛН
DAD LEFT HIS OLD SOCKS ON THE COUCH…😱😂
00:24
JULI_PROETO
Рет қаралды 15 МЛН
Useful gadget for styling hair 🤩💖 #gadgets #hairstyle
00:20
FLIP FLOP Hacks
Рет қаралды 5 МЛН
What is a REST API?
9:12
IBM Technology
Рет қаралды 1,5 МЛН
No-Nonsense Backend Engineering Roadmap
10:16
Codebagel
Рет қаралды 181 М.
WP REST API - Custom Endpoints
14:00
Watch and Learn
Рет қаралды 79 М.
How to Create Products in WooCommerce using Rest API
7:00
FineGap
Рет қаралды 20 М.
What is REST API?
4:55
Postman
Рет қаралды 41 М.
The Story of Next.js
12:13
uidotdev
Рет қаралды 557 М.
Как бесплатно замутить iphone 15 pro max
0:59
ЖЕЛЕЗНЫЙ КОРОЛЬ
Рет қаралды 6 МЛН
ВАЖНО! Не проверяйте на своем iPhone после установки на экран!
0:19
ГЛАЗУРЬ СТЕКЛО для iPhone и аксессуары OTU
Рет қаралды 6 МЛН
Как удвоить напряжение? #электроника #умножитель
1:00
Hi Dev! – Электроника
Рет қаралды 1 МЛН
iPhone, Galaxy или Pixel? 😎
0:16
serg1us
Рет қаралды 1,3 МЛН
Telefonu Parçaladım!😱
0:16
Safak Novruz
Рет қаралды 25 МЛН