WordPress REST API Basics

Поделиться
HTML-код
  • Опубликовано: 11 янв 2025

Комментарии • 73

  • @mediawijsheid952
    @mediawijsheid952 2 года назад +5

    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!

  • @edanbenatar
    @edanbenatar Год назад +3

    Great video! Love the simplicity and concise approach 🔥

    • @millertchris
      @millertchris  Год назад

      Thanks, Edan! We need to catch up soon.

  • @doctortravis
    @doctortravis 4 месяца назад +1

    Well damn! That was easy to understand. Thank you!

  • @stevenokanda7652
    @stevenokanda7652 2 года назад +1

    amaizing video got me started on the API can't wait to do something amazing with it

  • @KentaroxKondo
    @KentaroxKondo Год назад

    This is super helpful. Thank you, Chris!

  • @camilogarcia1325
    @camilogarcia1325 2 года назад +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 года назад +1

      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

  • @NareshBabu
    @NareshBabu 3 года назад

    This is new to me, thanks Chris!

  • @jayks777
    @jayks777 2 года назад +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.

  • @chainedereve8180
    @chainedereve8180 Год назад +1

    Great, but what is the purpose of these rest api ? What can be done with them, add or delete articles ?

  • @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?

  • @chrisder1814
    @chrisder1814 5 месяцев назад

    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

  • @chrisder1814
    @chrisder1814 5 месяцев назад

    hello, can I use it with the g.sheet api connector module?

  • @Johnello1
    @Johnello1 2 года назад +1

    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 !

  • @arunkaul5008
    @arunkaul5008 Год назад

    hello Chris Miller how can i get form entries data, what is the api for that

  • @harounaken358
    @harounaken358 2 года назад +1

    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 года назад +1

      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.

  • @ariyibimoses6127
    @ariyibimoses6127 2 года назад +1

    Is it possible we use api to dropship from hrkgaming to my wordpress website?

    • @millertchris
      @millertchris  2 года назад +1

      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

  • @nav3961
    @nav3961 2 года назад +1

    Sir, i have a question regarding wordpress.
    How to publish a manual article post to wordpress automatically?? (If we have huge content of post )

  • @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 🙏

  • @martinkaspar5095
    @martinkaspar5095 2 года назад +1

    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 года назад +1

      @@millertchris awesome - this is so great. Keep up your great project: it rocks!!!

    • @millertchris
      @millertchris  2 года назад

      @@martinkaspar5095 thank you!

  • @antdx316
    @antdx316 2 года назад +1

    What is the point of GET API? Is it to query that data and have only that shown somewhere else?

    • @millertchris
      @millertchris  2 года назад +1

      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 : )

  • @georgenessem2351
    @georgenessem2351 2 года назад +1

    I need to upload image to can use it in the posts

  • @alimosbah
    @alimosbah 2 года назад +1

    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.

  • @visualmodo
    @visualmodo 2 года назад

    Very good video!

  • @zeesh8394
    @zeesh8394 2 года назад +1

    Have a question where can I ask this?

  • @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.

  • @Shagunsingh-c2f
    @Shagunsingh-c2f Год назад

    we donot require client Id and client secret in postman to authenticate wordpress

  • @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}}

  • @dragonball-dragonatoraa8395
    @dragonball-dragonatoraa8395 Месяц назад

    ATTENTION I GET ERROR: {
    "code": "rest_no_route",
    "message": "No route was found matching the URL and request method.",
    "data": {
    "status": 404
    }
    }

  • @tomwallace6250
    @tomwallace6250 10 месяцев назад

    So since we can do this …. Is there a point to using GraphQL?

  • @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.

  • @davidjackson148
    @davidjackson148 2 года назад +1

    Hmmm. I only get one post and is seems like the default one :(

    • @davidjackson148
      @davidjackson148 2 года назад +1

      Fixed with a WordPress upgrade to 6.1.1, no idea what the problem was but hey ho.

    • @millertchris
      @millertchris  2 года назад +1

      Glad I could help!

  • @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?

  • @pellravi338
    @pellravi338 2 года назад +1

    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.

  • @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 года назад +2

      Absolutely! Not sure when, but hopefully I'll put something out by the end of this summer.

  • @michaelbelete2124
    @michaelbelete2124 Год назад

    Amazing!!

  • @harshmakwanaa
    @harshmakwanaa Год назад +1

    getting the 404 not found

    • @King-hs9zc
      @King-hs9zc Год назад +1

      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

  • @HerlindaRodriguez-z9f
    @HerlindaRodriguez-z9f 4 месяца назад

    Daren Lodge

  • @Prabh_cc
    @Prabh_cc 3 месяца назад

    peace of waste