REST API to post to my users' WordPress website - php

So, I have a website where I am allow users to aggregate certain settings into readable html pages that can be emailed or copied in html to be shared elsewhere.
What I would like to do now is use REST API in order to allow users to post this content directly to their WordPress blogs (independently hosted or on wordpress.com). From my research, REST API is the best way to go about doing this. However, I cannot seem to find any reliable resources on how this is to be exactly implemented or achieved (or if it is 100% entirely possible).
I'm hoping there are one or two people who have had experience with this sort of thing and who can provide me with some guidance!

There is no standard REST interface to WordPress. However, WordPress does have an XMLRPC interface to post, edit, and otherwise manage content. Information on this interface is available in the WordPress Codex at:
https://codex.wordpress.org/XML-RPC_WordPress_API

Related

Custom display of posts of Facebook, Twitter, Linkedi and Google+ on your website

Is it possible to shows posts, feeds etc in a customized manner on your website? For example if I don't want to use the plugins they provide to embed on your website which show posts in a rectangular box I want to show posts from these social media sites in different manner. For reference please visit this website and scroll down to section below Latest News and Testimonials you will find Facebook, Twitter, LinkedIn and Google+ with Lorem Ipsum text. It seems like this website has also not implemented this feature (don't know if its possible with all social sites) but I am asking if you need to implement something like this is this possible? I have to implement it on a PHP website, if that helps. Thanks for your help in advance.
Although you're asking for something different than embedding, I still believe what you're looking for is "Embedding posts". Most social sites do not want you to rebuild their stream experience and put it somewhere else -- additionally, most content policies on these sites prohibits you from caching or storing posts because it can easily become a privacy issue. Finally, if you're pulling a lot of posts, frequently, from these services, you will encounter API call limits.
The following resources should get you started with properly embedding posts so you don't have to worry about how you're caching:
Google+
Facebook
Twitter
If you (really, really) wanted to build out your own solution you should do it client-side in JavaScript, not in PHP. For this, you would need to use the following APIs:
Google+ uses the Activity API
Facebook has the Graph/Feed API
Twitter has the Search/Get Tweets API pass from%3A[username] to get specific user Tweets
If you were to try doing this in PHP, it would be easier using client libraries and starting from sample code.
Google+ PHP example
Facebook PHP client library
Twitter PHP client libraries
Make sure that you're following the content policies of the various sites you're aggregating. In other words, if you're doing something like caching the results in a MySQL database pulled using your PHP script, invalidate the cache every 3600 seconds and every time a post is no longer retrieved from your API calls.

Web services to interact between Joomla backend and iOS/Android app

We just started to develop an app where we need to get some data from a Joomla backend. (Data would be company profiles. Those companies register on the Joomla webiste and the public information gets displayed in our app).
What is the best way to communicate between the app and the Joomla backend? The information from the database just has to be pulled once at the start of the app and maybe by manual refreshing.
So far I have read about REST API and SOAP as web-services. I played a bit around with examples from the internet but wasn't really successful yet. So could one of you give a simple explanation and a small example for the interaction between Joomla backend and an Android app e.g.
If you are looking for a pre-packaged solution to turn Joomla 3.5/3.6 into a Mobile Back-end as a Service (MBaSS) you may want to explore cAPI Core REST API.
https://extensions.joomla.org/extensions/extension/capi-core-rest-api
Please note that this is a commercial plugin which I developed. If you are OK with that, you may read on here for more information from a previously answered question:
https://stackoverflow.com/a/32706378/5361267
API Documentation can be found here:
http://learn.getcapi.org
Swagger UI Docs:
https://demo1.getcapi.io/api-docs
To answer your specific question about profiles, this extension will allow you to read and update profile data associated with any user. In addition to the built-in profile fields, the profile creation methods allow you to create and populate unique profile keys. While these might not be visible in the joomla interface (because they have to be defined in XML as well), they can be queried / updated remotely as needed.
PUT /user/profile/{id}
https://demo1.getcapi.io/api-docs#!/User/putUserProfileById

How to use Google Login without plugin in WordPress?

I have seen some websites who allows their users to register or log in with social networks. I want to do the same for my WordPress blog, I already started to learn about it, but the more I read, the more I am getting confused. That's why I am asking for the help here.
I want to allow my WordPress blog users to log in or register with Google. I Have already created Client ID, Email address, Client secret, Redirect URIs, JavaScript Origins. But I don't know how to use them.
Well using a plugin for this sort of functionality is absolutely recommended, because you dont have to care about the security and other issues. Even seasonal programmers get a bit confused using the OAuth library but to start with checkout this tutorial it is as simple as it can be.
http://www.w3resource.com/API/google-plus/tutorial.php
Either way you will have to still create your own plugin and once you get the data from the google api, you will have to use a function like wp_create_user or wp_insert_user to register those users. This is pretty much what a (free) out of box plugin can do for you.

Is it possible to use Wordpress API to make posts on wordpress.com?

I'm aware that the wordpress API can be used to make posts to wordpress blogs hosted on your own server/website. However, is it possible to also make posts to blogs hosted on wordpress.com using the api? If so, where can I find the details such as the URLs to which to make the api requests, etc?
Currently I'm only interested in adding new posts to blogs hosted on wordpress.com and verifying the login info (so any function which will verify the login info without changing anything, e.g a method which returns the number of posts in the blog, would be fine).
I will be using PHP and preferably use XML-RPC to make the API requests.
Yes, you can use the API. The url you'll need is http://<blogname>.wordpress.com/xmlrpc.php
I have made use of the Windows Live Writer application to post to my own wordpress.com blog, and in the setup phase, this is the data it asked me to provide.
As for suggesting a read-only call to test login, I'm afraid my knowledge of the API is very rusty, so I can only suggest looking at the API docs.
HTH
hi look for http://codex.wordpress.org/XML-RPC_wp ,where u can find u all want
have dream day

Facebook Application and posting to a Page Stream

As usual, I'm having problems due to a lack of clear guide in the Facebook API Documentation.
Basically I have created an application that is installed to Facebook Pages, I want to periodically post automatically via my server to the Stream of these pages (of course, willing to have it authorised, etc), but I am just unable to find how to do this. I've looked at stream write, etc, but not sure how to best make use of this. I've looked at Extended Permissions, should this simply just work for Pages? I'm experimenting but not having too much luck at the moment.
Any ideas guys? Also, am I able to make use of the new "targetting" of users that Page administrators have when posting to a Page now?
Sorted out my previous problem, simply now wondering whether I can location target posts as Page admins are now allowed to do.
I am using PHP with the latest library updates btw.
Big thanks!
The way to post feed stories/streams is to use stream.publish function, check it out here:
http://wiki.developers.facebook.com/index.php/Stream.publish
And for automated publishing, you need to use cron job, here is how to get started with that:
http://www.aota.net/Script_Installation_Tips/cronhelp.php3

Categories