How can I get json information about a page that is on wordpress? - json

I am communicating with the guys over at google and they are helping us with our site 'central.bet.co.za'.
The guys over at google are saying that they need me to supply them with "CORS Compliant Predictive JSON Endpoint for the same."
I really dont know where to find this information as I have never used json before or wordpress for that matter
I have tried installing the json.api.user plugin but that doesnt seem to be solving any problems either

Do you mean the Wordpress core Rest API?
http://central.bet.co.za/wp-json/wp/v2/pages

Related

Program/tool for reading/logging http requests and responses?

I'm trying to log autocomplete responses from a gmail "people" server, and I'm trying to find a program or tool to do this, like the network section in chrome dev tools. I tried using a web crawler script, but authentication would be a mess. I also tried Wireshark, but it was all garble to me and probably the wrong way to go. Is this even possible? Can somebody help me, I'm totally out of my comfort zone here. please see attached image
It would be best to find an API that google makes public for the data that you need and use that to query the data. For people, google does have an API. Have a look here: https://developers.google.com/people
Tools commonly used to make HTTP queries are https://www.postman.com/ and https://curl.haxx.se/

Getting Specific Data from Post API in WordPress

I want to link my website's Wordpress database to mobile application; and I am able to generate the APIs using wp-json plugin in Wordpress.
However, there is a lot of unwanted data which I do not want for the app. What are the custom parameters in the API url which will help me get only the information I am looking for?
http://www.indiafastener.com/wp-json/wp/v2/posts/2031
PS: I know I can manage & eliminate the unwanted information through the app as well however I do not want to unnecessarily pile up lot of data & do filters in the App.
Thanks for your time.
Utpal
Modern versions of WordPress have the REST API built into core therefore a plugin isn't required.
To check the arguments for an API call, take a look at the documentation. For retrieving a post, see: https://developer.wordpress.org/rest-api/reference/posts/#retrieve-a-post. There are no arguments for limiting the data provided by the response.
While it is possible to modify the response (https://developer.wordpress.org/rest-api/extending-the-rest-api/modifying-responses/), I'd advise against it.
As you pointed out in your question, this data can be managed on the app side. I'd argue that is where you should be dealing with it. It's not about eliminating 'unwanted information' but rather recognising the information you do want.

Using Github login with a Django project

I'm working on making a site that allows login with Github and I'm using Django for this. I've gotten as far as redirecting the user to the github authorization page, and then redirecting the user to another part of my project after successful authorization. My question is then: How do i extract such things as the users username and other values? I imagine that a JSON object is sent to me, but how do I use it and where do I get it? I have never done anything like this before, so it might be obvious but if anyone could help me it would be appreciated. Bear in mind that I'm a newbie in Django.
Github login is just OAuth. There is full documentation on Github's dev site on how to do it manually, but you probably want to use one of the many Python libraries which make the process easier such as python-social-auth or django-allauth.
Check out:
https://developer.github.com/guides/basics-of-authentication/
But there is package with this functionality:
python-social-auth

google cloud print post

I'm trying to ultimately silently print using Google Cloud Print from a POST function that is called from code on a website.
I succeeded in testing cloud printing using my account and my printers using a form submit.
(you can see the code that worked for that here: https://stackoverflow.com/questions/23975931/programatically-change-file-name-in-google-chrome-print)
The form submit didn't ask me for any authorization that I could tell. It asked me for xsrf. I stumbled across the answer for this by testing here:
https://www.google.com/cloudprint/simulate.html
So my question is can some amazing person please take pity on me and post the entire code for POST to submit a print job to GCP INCLUDING the format for authorization and where I get that info?
I have read the manuals for cloud printing and the info on how to get an oauth (although I don't understand that part yet)
I am missing something that will be obvious to people who have done this before.
I have tried the php code at github - although I do not usually code in php.
I have programmed a lot of API's and there is something I am just missing here.
Thank you profusely in advance!
i developed this simple library in python. https://github.com/escube/GoogleCloudSpooler
You cna use as you wish.
I developed a server version as well, but the lib used is the one in this project.
Try to use it and tell me if you have problem with that, I'll be pleased to help.
You could try using an alternative service such as PrintNode which has an excellent API and is very simple to use.

How to use SecureSocial in a Single-Page-Application

I'm converting my Play 2 application to a SPA and I'm trying to figure out how to still use SecureSocial for authentication.
I'm removing all the HTML templates (except the ones used by SecureSocial to send emails) and modifying my controllers to only provide JSON responses.
Is it possible to prevent SecureSocial from rendering HTML and let my application exchange authentication data in JSON format? Is there any example or tutorial that explains this topic? I've been googling for a few days now and unable to find any useful or at least understandable information for a newbie like me.
Latest changes in master made SecureSocial more friendly with mobile and SPA apps. You can now use the LoginApi controller to authenticate a user using the UsernamePasswordProvider or any of the OAuth2 based providers.