How to Update Wordpress Post with REST API and Corona

So I’ve followed Rob’s great short intro to Corona and REST and I have successfully managed to RESTfully GET data from a fresh WordPress install.

My problem lies in doing anything else besides Getting info.

While WordPress does support Basic Auth, I’m getting a 401 response denying access to update.

I was wondering if anyone has successfully edited or created posts on a WordPress site through REST API with Corona?

Hi Mike,

I can’t speak to the particulars of Wordpress’ API, but I will say that if you’re working this issue through in your app and the simulator, a faster way to get there will be to use the awesome (and free) Postman app. You can make modifications to your API calls on the fly and see the response instantly. And once you’ve worked out the secret sauce that gets it right, just duplicate that in your Corona app via network.request.

You can get Postman here: https://www.getpostman.com

I’m not associated with Postman, just a fan who discovered it way too late. If I’d had it handy when developing the Twitter plugin, it would have saved me loads of time. :grinning:

At the end of the day, Corona as a client is no different than any other client. If you can successfully make an API call in Postman (or any other client), you can do it in Corona. Good luck!

Thanks Jason. I did see Postman mentioned a couple of times in my research and ear marked it to check it out. Will definitely have a look.

I have no doubt that Corona can handle this as I’m only talking basic CRUD requests and bare minimum authentication. And I am leaning toward the Auth issues lying with WordPress and their REST beta rather than Corona.

I’ll check out Postman and will update this thread if I find any more clues for anyone interested.

For those interested.

I did manage to successfully authenticate (via Basic auth) to a Wordpress build. I had to change the headers line to the following:

headers[“Authorization”] = "Basic " … mime.b64(“username:password”)

Hope this helps someone else.

Hi Mike,

I can’t speak to the particulars of Wordpress’ API, but I will say that if you’re working this issue through in your app and the simulator, a faster way to get there will be to use the awesome (and free) Postman app. You can make modifications to your API calls on the fly and see the response instantly. And once you’ve worked out the secret sauce that gets it right, just duplicate that in your Corona app via network.request.

You can get Postman here: https://www.getpostman.com

I’m not associated with Postman, just a fan who discovered it way too late. If I’d had it handy when developing the Twitter plugin, it would have saved me loads of time. :grinning:

At the end of the day, Corona as a client is no different than any other client. If you can successfully make an API call in Postman (or any other client), you can do it in Corona. Good luck!

Thanks Jason. I did see Postman mentioned a couple of times in my research and ear marked it to check it out. Will definitely have a look.

I have no doubt that Corona can handle this as I’m only talking basic CRUD requests and bare minimum authentication. And I am leaning toward the Auth issues lying with WordPress and their REST beta rather than Corona.

I’ll check out Postman and will update this thread if I find any more clues for anyone interested.

For those interested.

I did manage to successfully authenticate (via Basic auth) to a Wordpress build. I had to change the headers line to the following:

headers[“Authorization”] = "Basic " … mime.b64(“username:password”)

Hope this helps someone else.