XML reading from REST API in RuleChain (Thingsboard) - thingsboard

I'm trying to read external data with REST API as in this tutorial.
https://thingsboard.io/docs/user-guide/rule-engine-2-0/tutorials/get-weather-using-rest-api-call/
The problem is that my server answers with XML text and not with a JSON payload.
For this reason, the (blue) Script node within RuleChain does not accept the input and I cannot parse the XML text.
Does anyone know how to get around the problem? Should I use some other node? Or is there no solution?
Thank you.

Related

Swagger-UI how much modification can be done

I have some questions regarding swagger-ui. I have downloaded the swagger-ui from here and have played around with the index.html and tried modifying it. From what I understand the UI is dynamically generated based on the open api specification doc either in a yaml or json file format. My questions are as follows
How much modification can be done to the UI that is being generated by the Swagger?
Can "Try Out" functionality be modified to have more control? What I want to do is have few input fields which are not generated by swagger and use them as input for an api call, make UI more dynamic in nature.
Does the Swagger-UI depend on any sort of API gateway to make calls to api endpoints?
Thanks,
Salil
How much modification can be done to the UI that is being generated by the Swagger?
Swagger UI can be tweaked in very different ways mainly via JS or CSS.
You can have a look to https://swagger.io/docs/open-source-tools/swagger-ui/customization/overview/
Can "Try Out" functionality be modified to have more control? What I want to do is have few input fields which are not generated by swagger and use them as input for an api call, make UI more dynamic in nature.
You should have a look to the link I shared above but not sure this is doable like this.
If I had to do such kind of thing I would rather look at how to complete the original OpenAPI definition (the yaml/JSON file) before passing it to Swagger UI.
Note that there is also a "interceptor" feature in Swagger UI that allow to modify requests before sending them for instance. This might interest you.
Does the Swagger-UI depend on any sort of API gateway to make calls to api endpoints?
Not at all. Swagger UI just uses your browser to call the API at the URL documented by the OpenAPI file.
Stack Overflow doesn't work well when there are multiple questions as part of one "Question". Having said that, I'll answer what I know.
As far as I can tell, you can modify the yaml or JSON source as much as you like. You can write an entire file from scratch, or import it from any editor.
For this sort of testing, I think you might want to look for a more in-depth testing tool such as Postman. That's not something I have any experience with, but from what I hear it could help with "what if I send this request?" sceanrios.

How to parse GTFS data on iOS using swift?

I am using http://datamine.mta.info/list-of-feeds api to get GTFS data for United States transportation.
When you call http://datamine.mta.info/mta_esi.php?key=<key>&feed_id=1 api you get one "gtfs" file which contains data that I need to parse in iOS so that I can display.
Once I get the file, how do I parse it? So far I haven't found a way to do so. Anyone can help me on this?
Thanks,
Pratik
The MTA requires that you serve the realtime data from your own server, so you might as well parse the Protocol Buffers server-side, and then make your data available to your iOS app from your server. If you do it that way, then you can use e.g., a Python or C++ library to parse the PB into JSON or whatever and structure it in an optimal way for your app for download.

Using Car2go Api for iOS app

Hi I am trying to get the list of all car2go cars and use it for a test application, the only problem is I do not know how to get the information. I have gotten a consumer key and secret key but the problem is I am unsure how to get the file using the api and then once I get the file I don't know how I would read it since it is using xml.
The response from the html is on this site
http://code.google.com/p/car2go/wiki/vehicles_v2_1
once I get the file I don't know how I would read it since it is using xml
You'll need to parse the response to extract the data you want. There are a number of ways to do that. For example, you could use NSXMLParser (which is included in Cocoa Touch), or you could use the TouchXML library, or you could use libxml.

iOS: Convertion between xml and wbxml

I am trying to convert xml data in wbxml and the reverse too via my program. When I was searching in google, I found the following link was querying the same.
https://stackoverflow.com/questions/5088507/i-there-any-library-xml2wbxml-wbxml-for-iphone.
But, as per the answer, it doesn't have any sample source which converts between xml and wbxml data.
Can someone please guide me to get some referral code which converts between xml and wbxml data?
Maybe this can help you:
http://wbxmllib.sourceforge.net/html/files.html
http://wbxmllib.sourceforge.net/html/wbxml2xml__tool_8c-source.html
http://wbxmllib.sourceforge.net/html/xml2wbxml__tool_8c-source.html

Integrate Google Search Appliance with Rails Application

I wanted to integrate GSA with Rails. But the web proved to be un-helpful. Anybody knows any step-by-step tutorial.
First, you have to call the GSA with the search query. The reference informations for generating the GET-request is here: http://code.google.com/apis/searchappliance/documentation/610/xml_reference.html#SubmittingaSearchRequest
Then you will receive a xml response from the GSA with all needed information inside. The reference for the xml nodes are here (Look better at a xml response from your GSA and get additional informations in my link): http://code.google.com/apis/searchappliance/documentation/610/xml_reference.html#results_xml_tags
Last but not least, you have to parse the informations within the xml and generate your custom frontend.
I hope that will help you. It isn't really complicated.
Define "integrate" closer. The most things are language independent and have nothing to do with Rails/Java/.Net or whatever
Try using the gem rails-gsa this will help you a lot in integrating the Google Search Appliance with your rails Application.
Check out the documentation on github https://github.com/rohit9889/rails-gsa

Resources