• Hello!
    I’d need some advices!

    I have some experience with wordpress but I am totally unaware about“Restful API” cURL, Php,… etc!

    So they gave me this “info spreading service” using “restful APIs” with a personal token to have access to it (and a specific website to start request).

    I tried to read and acquire some infos but I can’t understand a thing!

    I also tried a free version of “Json Content Importer” (yes, they spread json) but with all those “templates” settings and so on, I did not understand how to use it. Now I am not even sure It could be useful to me!

    In the documentation I had they gave me just ENDPOINTS and how to re-call them:

    “https://api.justawebsite.com/live/2?token=123xyz””

    Could you please explain me how to call those APIs from WordPress?

    I am also ready to write PHP code for my needing (starting from your suggestion, as I can’t code!).

    Thanks for helping me, but with this case, just think you are explaining to a stupid .. very stupid 6 months child!

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    I’m sorry, but I doubt I can explain in simple enough terms, but since no other direction has been forthcoming so far, it may be better than nothing? I can give you some hints by way of reference docs, but taking that information and applying it into a practical application can be very challenging.

    If your end goal is to display the data returned on a WP page, you should place the required PHP code on a custom page template.

    To get the data from the API, you can use wp_remote_request(). The type of request depends on what you want to do with the API, I suspect you need to make a GET request.

    The data returned will be in JSON format, which PHP cannot work with directly, at least not very well. The data should be decoded into more conventional PHP array structures. This is done with json_decode().

    Individual e3lements of PHP arrays can be output using the echo statement.

    This will undoubtedly be inadequate on its own, you’ll need to fill in the gaps through other means to pull everything together. I hope this at least helps in some way, good luck!

Viewing 1 replies (of 1 total)
  • The topic ‘Retrieving data from a “Restful API”’ is closed to new replies.