how to import strongloop based api into json or yaml specification - json

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.

Related

Apache Spark call to AMADEUS API to display on 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.

Trying to retrieve JSON data from website api

Bottom line is that I'm trying to download my order history data from Lowes.com. I'm assuming there's an API endpoint that can be used but I haven't figured out the method or maybe what parameters need passed to get a successful request.
I looked at using python and scrapy but I don't believe the format of the webpages are going to be easy to parse the data.
I have found references to APIs in some of the javascript code for the website and the mobile app. Some of the relevant urls I've found:
From website -
ORDER_HISTORY_USER: '/wcs/resources/store/%0/member/%1/orderhistory/v1_0' (from function named Conduit on www.lowescdn.com)
From mobile app:
"url": "https://lwssvcs.lowes.com/IntegrationServices/resources/mylowes/user/order/list/v1_0"
"url": "https://lwssvcs.lowes.com/IntegrationServices/resources/mylowes/user/order/instore/v1_0"
So far I've only attempted to use these links via a browser after logging into my account. Assuming I'm on the right path, what method should I use to successfully get the data?

Azure Logic Apps: Read XML from file and Write a JSON with data

I'm new in it and trying to understand Azure Logic Apps.
I would like to create a LogicApp that:
Looks for new XML-Files
and for each file:
Read the XML
Check if Node "attachment" is present
and for each Attachment:
Read the Filename
Get the File from FTP and do BASE64-encoding
End for each Attachment.
Write JSON File (I have a schema)
DO HTTP-Post to API with JSON file as "application/json"
Is this possible with the Logic-Apps?
Yes, you can.
Check if a node is present, with xpath expression (e.g. xpath(xml(item()),'string(//Part/#ref)'))
For Get File from FTP, use the action FTP - Get File Content
Write JSON File, use the action Data Operations - Compose. If you need transformations, you have to use an Integration Account and Maps.
Do HTTP Post to API, use de action HTTP

Swagger 1.2 endpoint configuration is not loading

Im new Swagger user. I created endpoint with long model definition.
But when endpoint is attached to api-docs, this is not working. I checked that that endpoint configuration file is valid JSON file.
How to check where is the problem with with this file?
Im using Swagger 1.2.
Using bin/validate.sh should be able to help validate the files
https://github.com/swagger-api/swagger-codegen#validating-your-swagger-spec
e.g.
./bin/validate.sh http://petstore.swagger.wordnik.com/api/api-docs "specia-key" ./swagger-errors.html

How to view the data from the database in json format

I am trying to pass the data from the database to the controller through a service (WCF Data Service), which is an independent application. While running the service for testing, the data is shown in XML format. I need to view the data in JSON format. Any solutions??
Thanks in Advance
For JSON support:
Download the JSONPSupportBehavior.cs from the Microsoft Code Gallery
Locate the JSONPSupportBehavior.cs file in the downloaded project and include it in your web project.
Add a reference to System.Runtime.Serialization.dll.
Mark your service with the JSONPSupportBehavior attribute.
[JSONPSupportBehavior]
public class WcfDataService : DataService<SampleDbEntities>
Please refer this link
A Beginner's Tutorial for Creating WCF Data Services
Hope this helps
WCF Data services supports JSON out of the box.
In order to receive a response in JSON format, you can include application/json in the accept header of the request. Or you can use $format=json in your request url.