JSON Post to a url - json

I need to start with a new project where I need to get data from firebase. The programmer for the firebase app wants to post the data to me in JSON to a url. I have experience in PHP but I have no idea how to create this url to where he must post. Can someone please point me in the direction to go? Must I create a page on my website or what must I do here?
Help will be greatly appreciated.

I think you should start looking at creating a rest api on a server (I havent worked with php so dont know the best practices there but got this when i googled)
The rest api can then handle the post request and then save the data into firebase.

Related

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

Django Rest Framework(DRF) Json Web Token(JWT) Authentication and Login Process

I want to implement JWT authentication for my project since this seems to be the most simple one out of all the authentication procedures - but I don't quite understand how an User can actually login using the JWT-auth. It would be helpful if anyone could share some reading materials or provide some insights on the workflow of the login of an user using JWT.
My own thoughts were somewhat along these lines:
The frontend sends a obtain_jwt request to the backend via drf api
The api returns a token in json format, if username and password were provided
It's from here I don't understand what needs to done going forward. Does the backend need to do anything else to complete the authentication/login process? Do I need to do anything else with DRF Permissions?
If this completes the login process, then there is something else which bugs me. For example, I have an APIView LoginView which has a post method to handle the login process. Now, does the frontend need to call the obtain_jwt function to get the function and then do another post-method to the LoginView? Or is there a way to return the json-web-token from that LoginView?
It would be really helpful if someone could answer these questions for me or provide some reading materials which would help me better understand the total workflow for this login process. Thanks.
Edit: My login process is being made to handle a facebook login - just to let the viewer know :)
It's not that complicated after its explained to you. General workflow is:
Client sends a username and password with a POST request via javascript(ajax).
DRF receives it, authenticates and return a token to the client in json format.
Client receives the token and stores it. Token is stored on the header of ajax setup, so all subsequent calls in this app have the token in the header.
Now just make regular api calls, and authetication is submitted automatically through the header that DRF reads and accepts.
See this.

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

How can you POST to parse.com using REST API?

Forgive me for being a total novice - had a google but couldn't see the answer to this!
What i want to do is send data to an application (database) on parse.com. As i normally understand it the POST request would need the server address but parse.com does not provide a dedicated server (i think).
So does anyone know how to write the API to POST to parse.com?
thanks!!!
The server is api.parse.com, you then identify yourself using your app's Application ID and REST-API Key
The full documentation of the REST-API is available here.

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.