Apache Spark call to AMADEUS API to display on html - html

I have an assignement to display flight offers from amadeus api to an html page. In order to do that I need to first edit the json from amadeus with apache spark. How would selecting a date in html call the api to receive json and how would this json be transfered to apache spark in order to be processed? What would be a high level overview of what I am supposed to do ?
I thought to use flask in order to execute a python script to store the json in a folder that is monitored by spark streaming but I don't know if that is a good idea.

Related

How can I receive JSON data from a API in same django project without using other module or library?

I have a API defined in my project which returns JSON data in response.
url(r'^api/report/(?P<report_id>\w+)/generate/', staff_member_required(api_views.GenerateReport.as_view()), name="generate_report"),
In another app of same project, I want to receive this data in views.py
How do I make a request to this url using some django functions.
I think there might be some way to make this GET request without using requests or any other 3rd party module.
Any help would be appreciated.

How to connect Document Conversion Service with Watson Retrieval and Ranking

I have 100 pdf documents. I have used Watson document conversion service to convert pdf documents into JSON Answer Units. Now I need to train these documents.
I have written python code which needs JSON Answer Units and Document Relevency Score as input to Watson R and R. How to refer JSON Answer Units through python code or How to download JSON Answer Units from Document Conversion Service through Python API
I think you can see this example from IBM Developers (Node SDK).
This line show one example for refer JSON Answer units.
The programming language is other but you can use the same logic to do what you want, the Document Conversion integration example shows how to convert a document into Answer Units by using the Document Conversion Service and upload it to the Retrieve and Rank Service to make the Answer Units searchable.
Create a solr cluster, upload the solr configuration and create a collection
1.1 In the files retrieve_and_ran_lifecycle.v1.js and retrieve_and_rank_solr.v1.js you will find example functions
on how to perform these steps.
1.2 IMPORTANT: When uploading the solr configuration, use the [answer_unit_config.zip] from the resources folder,
which includes a schema.xml that defines the fields that will be indexed.
Edit the file document_conversion_integration.v1.js and enter the following:
2.1 service credentials for the Document Conversion and the Retrieve and Rank services (each service instance has a different set of credentials)
2.2 clusterId (obtained when creating the cluster)
2.3 collectionName and inputDocument if you are using a different value from the default
Run the following command:
node document_conversion_integration.v1.js

How does a .json file work in a API call?

I've been doing research in order to write an API for a school project, and when referencing the API documentation of YouTube and Twitter, I see API URLs like this
https://api.twitter.com/1.1/account/settings.json
My understanding was that you execute a method on the backend which will return information to the caller, but I thought those files had to be of extension type .py or .java or whatever language you're using, and JSON was just the return type. I've been unable to find any information on how a .json file works in this example. Is there code in settings.json that is being executed?
JSON is just a format of your data, that you can then use, for example in JavaScript.
It is back-end language independent. By this I mean, that front-end of the application does not care who produced .json file.
Maybe it was Java application, maybe it was Python, or PHP application it does not matter. It can be also static file, with fixed content which just has json format.
After you receive such thing in front-end, you can do with it whatever you want. From your perspective it will be probably some kind of nested array.
In example you provided, I get:
{"errors":[{"code":215,"message":"Bad Authentication data."}]}
And it is fine, it's just data you get. It is JSON format - that is true. But you don't care that path has .json in the URL, it could have any extension, what is important is what's inside.
That is a beauty of JSON. You can prepare for yourself static file with mocked data in JSON format, and use it while developing front-end of the application. When you wish, you can have back-end application which will return real data for your app.
You can also see here, how to return json file from PHP:
Returning JSON from a PHP Script
Or here to see how to do it in Python (Django Framework):
Creating a JSON response using Django and Python

how to import strongloop based api into json or yaml specification

I have an API who is generarted using loopback / strongloop and its running as follows.
and i want to export the the generated api into yaml or json so that i want to reuse it in another application. i m looking for swagger.json file.
SO in sawgger you get your json from your running api by going to localhost:3300/api-docs. How do i get it from here ?
You can do that with
localhost:3300/explorer/resources to get a list of all resources and localhost:3300/explorer/resource/ModelPluralName to get swagger for specific resource.
Also you can click on "Raw" link in your API explorer.
*Assuming of course that your application is running on localhost port 3300.
you can do that simply by typing
localhost:3300/explorer/swagger.json ,
you need to download the json file and load that into editor.swagger.io using file import then download it as YAML to feed into your restAPi ppliaction.

load data into mysql from restful web services

I want to load some data into mysql from a restful web services.
The API accepts http requests and returns xml output.
I want to load the xml output into mysql.
How can I do this ?
as I see you would like to do two steps in one ;) First that you should do, creating a Java object from XML (unmarshalling) and 2nd, save the object to DB.
For 1st, you can use JAXB or other free tool. For 2nd, use Hibernate ;)