Wordpress api, getting users data - json

I'm currently working on an application in titanium appcelerator, alloy - where I'm pulling data from wordpress via rest api.
My problem now is that I need to get the data from the the users of the of the wordpress site. Info like name, email ect.
Anyone ever tried or know how it's done? The end tag: /users? Doesn't seems to be enough

In accordance with official documentation on WP-API docs data that you need is not accessable through standart API requests and endpoints (it is only "visible" during editing).
But you can create your own route and using internal API/hooks to get all data and return it in json format in prefered way (see Adding Endpoints section on provided before site).

Related

Looking up values in html in background of iOS app

I'm new to iOS development and I'm trying to make an app that tracks my student loans. I would like to have the app simply display a balance found on the loan's website and build on that behavior. I've got my app to open up safari to the website but I'd like more of a web-crawling behavior so it's done in the background. This web-crawler needs to be able to login to the website and then find a field with the loan balance value..
I've looked up several ways on how to do this but I can't get any of them to work with my novice level of experience with swift. If anyone has a recommendation and a direction to go with this, that would be great.
Thanks in advance!
I've written an app to get my uni's schedules, payment records, and grades by bypassing the login and gain access to API used by the website.
The step you could take are probably very similar to mine
Find out how the website authenticate its users (could be by cookie, session id's etc) You need to have some knowledge on web too. You can use the network tab on Chrome/Brave/Safari or any other browser to see what the website is doing when you click on 'login' for example. You could use Charles too, 30 days of trial should be enough.
After authentication succeed, track what API route the website use to get the datas to html. See what information you need to access the API route. Postman would be very handy to see the JSON response by the API.
To parse the response, you can use URLSession or networking library like Alamofire to get the job done.
If you want to see how I did it, here's the GitHub repo.

How do I make an API query and display the Json result?

I'm using an API to receive information from a server. I'm authorising using a token. I can query using curl or various api testers online. But now I'm trying to learn how to implement (and request) the results in practice.
I'd like to query, parse and display the json result on a web page (preferably a Wordpress site).
So I need to make a get request, authorise myself using my token, and receive the result and then display it in a nice way.
How do I do that?
This is a vague question, not really sure if you are making requests from just one side but you have 2 options, albeit one being better than the other.
You can create add multiple functions inside your themes function.php file to extend its capabilities but again these are limited to only the theme you are using.
I would recommend that you build a plugin, this will give you the flexibility to use both JS and PHP to do whatever you need to do. With this method you can create a shortcode to display the results from your API query.
You will need to learn to use the Wordpress function wp_remote_get() to perform external API calls.
Here is a tutorial with more information:
Create Plugin and Create External API Calls
Parse JSON from Remote API
Hope this helps

Outlook API to get contacts in JSON format

Im trying to validate if the contacts that I have imported to the outlook contacts is been important, I was thinking to use and API call to get an JSON file to see if the contacts have been imported correctly or not.
I am fairly new to using API calls and Im not sure how to use Microsofts outlook APIs to achieve my goal.
any snippet code in Java, C#, Node.js would help
Im also not sure how I can get the auth key
Thanks in advance
First you need to decide what kind of authentication approach you need to use, and then you need to register your application. This article can help you decide: https://developer.microsoft.com/en-us/graph/docs/authorization/auth_overview.
Once you have acquired a token, use the Contacts REST API to work with contacts data. There are examples here:
https://msdn.microsoft.com/office/office365/APi/contacts-rest-operations
You can also use the Graph Explorer to test out various API calls and see the results in JSON: https://developer.microsoft.com/en-us/graph/graph-explorer

Templating JSON from REST results

Premise:
This question is more like "is this the correct approach?" rather then "how do I do this?"
Situation:
I have created a CherryPy REST application following this tutorial. The data are returned using the json module with a simple json.dumps. This example works. I have a mako template which I would like to use to create a HTML table with the data. Again, the template by itself works.
The question: In my head, it works this way:
The user asks for a URL
The REST API creates the JSON with the results
The mako template produces the HTML given the results
The HTML is returned to the user
My problem is, I'm not sure this is the right approach: in my (small) experience, the JSON should be returned to the client, which should render it in some way (using jQuery or some other client-side language); instead, the mako template works on the server-side, and that's where I got stuck.
Do you have any advice?
You don't need REST to solve this, this is a regular web application. Just to show you how this works by a REST service:
The user asks the REST client to do some-automated-stuff on the service
The client requests example.com/api/v1 to get the main page
The client looks for hyperlinks on the main page
The client finds hyperlink with relation=some-automated-stuff
The client follows that hyperlink and gets a JSON result from the REST API
The client uses the mako template and produces the HTML given the results
The HTML is returned to the user
A typical client is a 3rd party server side application, which is registered by the service and got a unique API key. The users allow to the clients to do some-automated-stuff on their account by giving permissions to API keys. So for example the service can be the facebook API and a client can be an application developed by Zynga e.g. Farmville. When you allow to the client to post on your news feed that you just harvested 100000 crops on your farm, then it sends a request about this to the facebook API and so some automated message will show up on your news feed.
Ofc. you can write a 1st party AJAX or server side client if you want, but if you don't want to support 3rd party clients, then it does not make much sense to develop a REST service. Ofc. your client won't break as easy as by regular applications, so it might worth the effort if that is important.

obfuscate json from webserver

I've got an android and iphone app that both get the required data from a webserver. The data is sent via json to the client. Using this setup other people might simply retrieve the url the app is calling and this way could make use of the data that I gather with my scripts on the server. To make it short: I don't want that :)
My idea is to make the json unreadable for example by encrypting it. This would make it a little harder to retrieve the information since this way some who would like to use my service would had to decompile the app an lookup any decryption stuff I had implemented.
Therefore two questions:
Do there exist some libraries that already offer such a functionality (Server side is Java)?
Does anyone of you have any other suggestions how I could protect my api from unwanted guests?
Thanks in advance :)
I think the options available would be...
to lock down the API to Authorized/Authenticated users.
Using BSON to obfuscate the data.
You could always use oAuth to allow the users to authenticate based on an account they already have: Facebook, Twitter, Google etc.