How to get posts from wordpress

Can anybody tell me, or point me to a tutorial that teaches how to get wordpress post where all I need is the title, excerpt, image, and body of the 10 most recent posts? The rest api integration in appgyver is the craziest thing I have ever seen. And I cant find any tutorial in appgyver learning that explains how to use it.

Can you do this outside AG… like on a url?
If so, that data can be grabbed inside AG.

Show me a URL that’s gives you the data you want.

That’s interesting, I find it rather intuitive but I’ve been working with different API tools maybe that’s why. Anyway here’s how you can do it.

Documentation:

To try it in Postman:
https://www.postman.com/avionics-specialist-27554543/workspace/work-2-0/documentation/15086392-e8a0648d-b23b-4eb8-af97-93a2af65e0c0

GET request to https://{{site}}/wp-json/wp/v2/posts

Add Authorization Header



Now there’s a trick… If you simply make a get request, you’ll get the CORS error. You need to create a proxy or make changes in the WordPress API file directly. But the great thing with WordPress, there’s a plugin for every single thing. Once I activated the plugin below and enabled cross-origin headers, it worked like magic!

I used Basic Auth for demo purposes but strongly suggest searching for another way, I’m sure there’s a plugin for that too.

2 Likes

I’m sorry I haven’t thanked you yet I have been beating my head against a wall trying to upload a simple image to firebase storage in appgyver app. It seems absolutely impossible, and nobody has any clear answers anywhere. I will have to get back to the wordpress. A professional developer gave up on trying to figure image uploads out in firebase/appgyver and passed it on to me, now I’m up shit creek.

I figured it out, by the way. I learned how to get nested values using formulas which you cannot use with the standard “data item in repeat” option.

Hi.
I made the same with this plugin and it’s working fine.

https://wordpress.org/plugins/jwt-authentication-for-wp-rest-api/

I use it for CCT of JetEngine plugin.

What I don’t know how to do is configure the header on the HTTP Request in “Logic”

I dit it! It’s a problem that I’m new in this and did’nt know how to make it.

In optional inputs
image

You have to input the header with the authorization token like this if you use Token Auth

image

If it useful for someone else

1 Like

thank you. I have to figure out how to whitelist all my other api integrations to use that jwt plugin.

I did’t whitelist anything…