How To Interact With A Simple API in WordPress - Advanced WordPress Tutorial

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

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

  • @WPCasts
    @WPCasts  4 года назад +7

    Sign up for the newsletter to notified about the free 2020 WordPress Development Course: wpcasts.tv

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

      i cannot reach wpcasts website

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

      Link is an empty wordpress website. By the way thank you for great video.

  • @mountainman9570
    @mountainman9570 4 года назад +112

    I really enjoyed this! Thanks for speaking slowly and clearly. I am 75 and trying to learn a bit more about Wordpress. I support about 6 sites and would like to learn how to do some customization work.

    • @sameermishra3598
      @sameermishra3598 3 года назад +11

      Wow ! Keep inspiring us young ones sir!

    • @killerdude909
      @killerdude909 3 года назад +4

      how are you doing today sir?

    • @stephenm3874
      @stephenm3874 2 года назад +4

      Sweet! I'm 67 and started programming when I was 47 and made a nice living from it. You rock!

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

      thats awesome!!!

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

      Hey Mountain, I really inspire me. Best of luck

  • @chrisklightandsound2801
    @chrisklightandsound2801 4 года назад +19

    Just to give some feedback, this tutorial really helped me to get an api integration running on my company. As someone with a very limited background in coding, this was a perfect starting place. Thanks

  • @priestofpsi
    @priestofpsi 3 года назад +6

    As a programmer who has never touched wordpress, this was brilliant. Learnt far more from this (i actually watched this) and learnt the exact thing I was wanting to.
    Excellent excellent excellent video!

  • @RobertoTenil
    @RobertoTenil 2 года назад +9

    Correct me if I'm wrong, but when you put >= on line 73 (31:40), the = takes away the whole purpose of the function, which would be to update only the newest ones (>). Those with the same timestamp (=) shouldn't be updated.
    The tutorial is excellent, and it helped me a lot. Thanks. 👍

  • @stillready6405
    @stillready6405 2 года назад +7

    Wow. This tutorial is really good and you made it very easy to follow without skipping important parts and giving a clear path to follow. I'm glad I found the video!

  • @justinbrown8214
    @justinbrown8214 6 месяцев назад +1

    Is there a reason to do this with recursion instead of a for loop? It seems easier to me for my cases.
    Thanks!

  • @kerimtim
    @kerimtim 3 года назад +2

    Your videos are just unbelievably simple professional and amazing

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

    Excellent. I got a bit confused by the end but overall, thank you for showing everything from scratch instead of keep saying "i already wrote half of the code offsceen".

  • @imarkdesigns
    @imarkdesigns 4 года назад +17

    THIS video helped me saving my ass to my project. I really appreciate your effort on doing this video. Thanks Alex!

  • @rickyrozario1577
    @rickyrozario1577 2 года назад +4

    Hi, first of all great video! Learned a lot from it. I have one question, What if a brewery is deleted from the API? How will you find the obsolete brewary in your WordPress database and delete it there as well? What checks can we run to achieve this?

  • @JassarDev
    @JassarDev 4 года назад +4

    Not specifically looking for this function but this tutorial is amazing!

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

    Amazing tutorial! It helped me out soo much! Something I think that is missing is removing a brewery from WP if it no longer exists in the API response. Easy enough to figure out though.

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

    Wow. This is a great video tutorial, a starting point for integrating any possible API. Thank you!

  • @JerryFerguson
    @JerryFerguson 11 месяцев назад

    Hey Alex! Amazingly straightforward video and exactly what I needed for the project I'm working on! Right on!

  • @paul7973
    @paul7973 4 года назад +19

    One of the best tutorials I've seen on this subject by far... but I died when you decided not to show the front-end. Do you think you'll ever take what this tutorial delivered and extend it a little further to show how you created what you did with the map and search etc?

  • @jakeparrotta7372
    @jakeparrotta7372 3 года назад +1

    Wow I was able to do this line by line, and then repurpose it for another API. Thanks so much WPCasts, let me know if I can buy you a coffee (virtually) Cheers!!!

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

      Nevermind lol found your Patreon!! 👍🏼

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

      @wpcasts If you have a moment to reply I am really stuck! I am finding that my it takes a long time for my admin-ajax call to load, and some of the posts are duplicates. Is this because I am overloading the script with so many db queries and update_fields? I am mapping over 270 fields for many post objects at once. What would be a better action hook? maybe init? or some wp api one? Please help

  • @theman7050
    @theman7050 3 года назад +1

    This is a legendary WP video!!

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

    Great tutorial! I'm trying to figure out how to import products into WooCommerce via an API. This has helped me immensely.

  • @seniorlyxbo2208
    @seniorlyxbo2208 4 года назад +4

    Great tutorial ..... BUT what if a brewery is deleted from the API list, then its not deleted in the local db?

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

      You can create a service to verify "closed" breweries.
      For example:
      Comparing “local” breweries array x remote array and then remove the “single” local brewery.

  • @onemoreprince
    @onemoreprince 4 года назад +1

    Really very helpful. Content on a topic like this is scare & due to such reasons it is very tough for a non-coder with good experience of working with themes & plugin (even some advance plugins like toolset, pods) can do pretty easy things like using API.

  • @berenjor
    @berenjor 4 года назад +2

    Is it possible that the key for each field in custom field is now only available with the pro version of Advanced Custom Fields?

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

    Hi
    I'm japanese.
    your video is very great‼
    Thanks

  • @AiBusinessConsulting
    @AiBusinessConsulting 5 лет назад +2

    Very nice tutorial. What editor do you use? Also could you have got this brewery info from the Google API? Also you should consider integrating Google reviews and when you got time change it so when some wants directions they stay on your site. I am really impressed with what you have done here and how simple your explanation was.

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

    very nice !!!!! question .... how did you do the map thing

  • @victor_venema
    @victor_venema 5 лет назад +8

    Nice to see how this works.
    If I see it right, for every iteration with 50 new breweries, you also (check to) store all the old breweries again: the foreach() goes over all breweries, not just the new ones. The final result will be okay, but it is a bit wasteful.
    Is there a special reason to do the recursions by calling the page via Ajax? I never coded something recursively in Wordpress. Could you not directly call the function? If not, wouldn't a while() be an easier way to handle an unknown number of API calls?

    • @bobbuilder3748
      @bobbuilder3748 3 года назад +2

      This isn't really recursion, it's a way to send requests sequentially without blocking. Using while or calling directly would block, and calling functions recursively to handle an unknown amount of data is a bad idea.
      I also noticed the 'feature' where breweries are updated unnecessarily. That didn't bother me so much, but there is one glaring omission to this example. What happens if a brewery is deleted or renamed? Deleted entries are not removed, and renaming would cause duplicate entries. There is probably no need to create a new unique ID. A sane API would assign a permanent unique ID, so I would assume the 'id' filed provided by openbrewerydb to be the unique identifier unless documentation specified otherwise.

  • @ahmedmusawir
    @ahmedmusawir 5 лет назад +6

    Amazing!! Can you plz give us a how-to series on building a whole CRUD app using WP Graph QL and React? Pleeeease?

  • @justinbrown8214
    @justinbrown8214 7 месяцев назад

    What's the best way to do this if the API I'm using has multiple dimensions to the data? Is there a different custom field data type I can use?
    Thanks for your video!

  • @justinbrown8214
    @justinbrown8214 6 месяцев назад

    Hi @WPCasts,
    Love your video. I'm making progress but my api is a bit more complicated as it's json array has multiple dimensions to it, I can successfully parse info from the first dimension, but none of the subsequent dimensions.
    Do you have any idea why this might be?
    Thanks a bunch!

  • @johnballo2402
    @johnballo2402 4 года назад +2

    Do Bank API also for a gateway payment. Thanks

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

    Do we have the tutorial for building the map section? I have this part done all ready :)

  • @phoneyiam123
    @phoneyiam123 3 года назад +1

    Any idea as to why there would be two entries created instead of just one? They both have the same permalink but show up twice in the Breweries CPT.

  • @andreas-stricker
    @andreas-stricker 3 года назад +1

    really nice explained! But what if a brewery gets deleted in the api? The brewery would still exist as a custom post type, right?

  • @Arnaudherr
    @Arnaudherr 7 месяцев назад

    Hey thanks for this very helpful tuto 😇 How can we deal with multilingual blog using polylang ?

  • @mayanikolova8353
    @mayanikolova8353 4 года назад +1

    Incredibly useful and well delivered. Thank you!

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

    This was a phenomenal explanation. Thank you!

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

    this is exactly what i needed

  •  4 года назад

    Dude! you cover every theme I am looking for! I just seen the first minute of this video and its just what I need. Thank you! Where is your patreon page!

    • @WPCasts
      @WPCasts  4 года назад +1

      I’m so glad! It’s www.patreon.com/wpcasts we also have a few exclusive videos over there :)

    •  4 года назад

      Found it!

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

    Thank you so much! As useful as usual! Keep inspiring us. Thanks a million. I've been waiting for this forever.
    I cannot thank you enough 👍 - plz keep up the awesome work i would love to see more of your great vids - ...

  • @vikkiphillips6652
    @vikkiphillips6652 4 года назад +5

    Is there a way of making the data live? So instead of cron running weekly it's more instant - as soon as a change is made the post is updated?

  • @jameschoyens23
    @jameschoyens23 4 года назад +2

    I finished an Ad as a thank you.

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

    Its really awesome video,
    do you have any video based on using the api data from custom fields in the Website?

  • @felixlvh
    @felixlvh 4 года назад +1

    Will you have a complete course for integrating third party api to wordpress?

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

    Hey Alex great video! Really glad I found you! Did you happen to do a video for when you created the interactive map for Brewlala ?

  • @nagg9007
    @nagg9007 4 года назад +1

    Really helpful. Looking for this kind of stuff. Can we display this on seperate page? Let's say Im integrating with different API, so for each API I need to create a page then show results there.

  • @MichaelRBurke
    @MichaelRBurke 3 года назад +4

    Because of this video I just realized API backwards is IPA.

  • @guizuk3
    @guizuk3 5 лет назад +1

    Incredible, man! Good job you did here, congrats!

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

    thank you very much for sharing the content, by any chance if I want to save the information in taxonomies, could I save it?

  • @fissunix
    @fissunix 5 лет назад +5

    Awesome tutorial !

  • @manassane4681
    @manassane4681 4 года назад

    Great video. To the point. Can you help me in understanding which theme is used here?

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

    Hi, this tutorial is very helpful. I do have a question about being able to replicate this using the Divi Theme. Thanks!

  • @user-ub7xo3qz2b
    @user-ub7xo3qz2b 5 лет назад +4

    Thanks for another amazing tutorial. I really hope you set up a patreon or do a udemy course at some point, it would be great to support such useful content!

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

    I have 2 wordpress websites that I need to sync the ACF dynamic field between them.
    When some list is uploaded at the first website, I want that the same list will be upload on the 2nd website, automatically.
    What is the best way to make it happen?

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

    Is there a reason to do this recursively instead of a simple loop?
    Recursive functions are notoriously ineffecient, at least in app and desktop development, and can result in memory issues, especially if the call gets stuck due to a programming error with the return/exit logic.
    Only just reason I can think of is if php actions asyncronous and you are trying to spread out the load.
    New to web dev so I'm unsure if it works that way. Seems like actions are really just function callbacks behind the scenes. If those are called based on intervals or events then I can see the reasoning but if they are called procedurally then this would be much simpler and efficient with a loop.
    Feedback is appreciated, as is your video. Great for experienced programers new to wordpress dev.

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

    Wow! its very usefull. I have one question, What theme do you used in this example?

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

    Hello Thank you for this, i subscribed because of this. question do you have something that interacts with the external API like CRUD? i think this included a authentication if im right. thank you again.

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

    Why not just use a for loop tho?

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

    Great overview of some new to me wp functions. I learned several things from your video. Thanks!

  • @hkyoyo
    @hkyoyo 4 года назад

    I love this cast. Great work mate!

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

    Hi , i have a question about this part 'if( $brewery->updated_at >= $exisiting_brewerey_timestamp )' , why you checking '>=' , then condition will always be true , not only if job 'updated on' was bigger , also you are checking if post exists by 'slug' , if in the api title is changed , that will be considered as a new post , which will add post twice

  • @pasizdobrekuce
    @pasizdobrekuce 4 года назад

    I want to buy you a beer. This is actually one of rare WP "real world case" tuts. Include "buy me a beer" link in your posts.

    • @WPCasts
      @WPCasts  4 года назад +1

      I'm really glad you found it helpful! The only thing I have currently is a Patreon: www.patreon.com/wpcasts

  • @anigarzat7
    @anigarzat7 8 месяцев назад

    Great!! I am looking for a wordpress plugin or script that works with ticketmaster API to import the events or concerts from ticket master into my worpdress pages or posts. Can you help me? thanks!!

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

    Hello, how would be the process to insert url of external images to an acf pro gallery?

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

    Thank you for this very useful tutorial. However in my case I was not able to write the fields created by ACF. I was able to see the post titles in the custom post type I created however not necessarily the contents of the ACF fields I created. What in your opinion is the problem? Thank you...

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

    Congrats for the tutorial. It really helped me.

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

    I really appreciate your effort on doing this video. Thanks!

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

    Could you please make a video on how to import/use the code. Thanks

  • @VinceAlvare
    @VinceAlvare 5 лет назад +2

    Very nice tutorial! I'm hoping this helps me work out how to scrape the ebay trading API and import to WooCommerce product data on a daily cycle. I could definitely see myself using this with ACF in the future as well. I'm not a php pro, and my API experience is limited, so this is extremely helpful in just wrapping my head around things. Keep the vids comin!

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

      how did you upload variable products in woocommerce?

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

    Hi, I really enjoyed this video!! I have a question regarding the json showing in the wp. I did all the steps u showed, but still couldnt get any data! Ps the API is showing as XML(not as JSON), could that be the problem? Thanks in advance :)

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

    Cool, but what If I don't have an 'updated at' value return from my data? How can I check if the information was updated?

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

    Thank you. I have an api in which I’m registered with id and password, why wp_remote_get return me an unauthorized response ?

  • @meeramadhu4392
    @meeramadhu4392 4 года назад +1

    hai,,,, how to get the product inforamtion from one ecommerce website to another by using api can plz suggest a youtube video realated to that.

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

    Is there a way to protect a custom Rest API especially when POST Request

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

    Very clear and well explained. Thank alot.

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

    how can we register a hook to external api. lets say I have api, it spits out changes based on some events. I want to hook/listen to those changes in wordpress. (API hooks)

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

    Creating of such Custom Post Type will allow anyone to update values through REST API by checking wp-json options?

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

    Increible tutorial, ya con esto lo combinas con un oage builder y haces magia, de verdad muchas gracias

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

    Is this storing the breweries data into the wp MySql server? Or is it calling it every time the costomer comes. If it does call it once and store it then how do you handle updates?

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

    How we could make a Webhook so for example when a Plugin is installed to send a REST API call to a 3rd party backend and not using cron job?

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

    Please create more videos on API integration in wordpress. And thank you so much for such a Great video sir 😊❤️

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

    this is amazing. really well explained and informative. thank you.

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

    Yes. I having problem following this tutorial.. Can you help me with it.

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

    Would you be willing to teach me more about WP API work? I live in SW Harbor ME. Thanks

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

    How would you go about adding images and image galleries to the ACF from the API information? Is there any way to contact you to get a quote on such a project?

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

    Can we create the CPT with a plugin instead of coding?

  • @janpanev2820
    @janpanev2820 4 года назад

    Thanks for that great video! Which program do you use for coding? I like the Wordpress tooltips it's displaying.

  • @andyhinkle
    @andyhinkle 4 года назад +1

    Thanks for the great example! Do you have any tips for garbage collection? Say the brewery no longer exists in the API but it will still remain in your WordPress collection?

    • @WPCasts
      @WPCasts  4 года назад +2

      Possibly a separate Cron that is monthly? It would probably have to delete and re-add all the breweries.

    • @phusion81
      @phusion81 4 года назад

      Could you do a looped api call for the specifc brewery id for each post you have, if the response is null then delete that post.

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

    If I would decide, could I achieve this with Python instead of PHP? thanks in advance

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

    Thanks a lot!!!, this video really help me.

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

    gr8 tutorial. Have u stopped making tutorials?

  • @FilthySnob
    @FilthySnob 3 года назад +1

    I dont understand why you chose to make the function recursive instead of using a loop and append to the array and increment current_body

  • @autotunekilledthevideostar639
    @autotunekilledthevideostar639 4 года назад

    Can I integrate API from Ebay and Discogs into a Wordpress website I have built ?

  • @DavidMSSmith
    @DavidMSSmith 4 года назад

    Is there a followup video where you show how you created the front end? Otherwise, pretty cool!

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

    Hi, do you offer a development service? I need something list this with little bit of modifications. Thanks

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

    where do you save the edited code in the wordpress?

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

    What if we are using a wordpress theme with a custom post type that does not show Field_keys?

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

    can we do without advanced custom field ?

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

    How could i work with products instead of custom post?

  • @platformfamily8743
    @platformfamily8743 4 года назад

    hello when i try to call admin url it gives me result of only one page but when i used it to fill the report.txt it goes through every page ..

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

    I have a question which may sound really stupid. Can the user of the website see these API call requests? Because I am using an API that requires a key so that key should be hidden from the user. So is this method secure for hiding the API key?