Google and Yahoo Weather API [closed] - weather

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
I created a google weather api which allowed a user to type in a city and get weather details back for 3 days.
Google have since shut this service down.
With yahoo api i need a WOEID to get the weatehr details. Is there a way for me to get weather from yahoo for 3 days and change a location to a WOEID in the process or should i look at alternative api. An example of what yahoo api requires is below.
http://weather.yahooapis.com/forecastrss?p=SFXX0044&u=c&d=5

I would strongly recommend using forecast.io, which is very easy to use APIs with rich weather data sources

I'm using OpenWeatherMap for my website. One alternative you may check out.

Another good alternative would be the OpenWeatherMap. for any given location it offers the urrent conditions, the weather forcast and a very attractive interactive map.
The OpenWeatherMap offers historical data, although the list of available cities of the free weather data plan is limited. Unlike the Weather Underground API it allows for a lot more than 500 calls per day.

You can check out this free weather API - https://www.mashape.com/george-vustrey/ultimate-weather-forecasts#!documentation
Sample result of San Francisco 7-day weather:
[
{
"day_of_week": "Mon",
"high": "80.23",
"low": "56.19",
"condition": "Partly cloudy in the evening."
},
{
"day_of_week": "Tue",
"high": "78.32",
"low": "59.2",
"condition": "Mostly cloudy throughout the day."
},
{
"day_of_week": "Wed",
"high": "87.21",
"low": "57.64",
"condition": "Mostly cloudy throughout the day."
},
{
"day_of_week": "Thu",
"high": "90.1",
"low": "60.91",
"condition": "Clear throughout the day."
},
{
"day_of_week": "Fri",
"high": "88.66",
"low": "57.88",
"condition": "Clear throughout the day."
},
{
"day_of_week": "Sat",
"high": "86.5",
"low": "54.11",
"condition": "Partly cloudy in the morning."
},
{
"day_of_week": "Sun",
"high": "89.62",
"low": "52.42",
"condition": "Clear throughout the day."
}
]

I'd look at an alternative. Getting the WOEID is complex (and changing to a pay-per search model), and Yahoo's API doesn't offer much more than the current conditions at the location.
The Weather Underground API is one that offers a fairly rich amount of history. However, if you exceed 500 calls/day, it will cost you at least $520 per month for their API access.
There are other weather APIs out there. Most history APIs are paid services. It pays to shop around for the best price for what you need.
If you're site is country-specific, your country may have a free data product. Look at the NOAA data services for the USA or the Met Office services in the UK for example.

Yahoo! weather APIs is DEAD at 3rd April, 2013.
You can use Metwit weather api.
If you can implement them client-side: 200 request/day (ip based throttling) no authentication required. Worldwide coverage, JSON and REST compliant. You can register for extra API calls for free and if you still need it to call them server side the basic plan is pretty cheap.
Here a little example in jQuery: http://jsbin.com/isukam/1 that use our weather resource.
Full disclosure: I own this sweet piece of API.

Related

How to call a web-action from watson assistant dialog node?

I am trying to call a simple web-action from my dialog node. Both service and cloud space is hosted in London, still I am getting error that "Direct CloudFunctions calls are not supported on this platform".
I have created a simple skill and added 3 nodes to it, 1 is welcome node, second is test node in that I have added action of type web-action and created a webaction on cloud that returns a simple message. Below is the details for test node and action.
{
"output": {
"generic": [
{
"values": [
{
"text": "Hi how are you $message"
}
],
"response_type": "text",
"selection_policy": "sequential"
}
]
},
"actions": [
{
"name": "/namespace_dev/default/Call DB",
"type": "web_action",
"parameters": {
"mob_num": "$MNum"
},
"credentials": "my cloud function creds",
"result_variable": "message"
}
]
}
Below is the web-action code.
function main(params) {
return { message: 'Hello World' };
}
Node when test node is invoked the action should get executed but I am getting below error.
Dialog node error
Direct CloudFunctions calls are not supported on this platform
Can someone please suggest what mistake I am doing?
Currently, as stated in the Actions Docs, the actions are accessible only in Germany and US South. However, this document differs based on the language you read in. In the German Version, which is my default, you might read this:
Gegenwärtig können Sie eine Cloud Functions-Aktion über Watson Assistant-Instanzen aufrufen, die in den Regionen 'Vereinigte Staaten (Süden)' oder 'Deutschland' gehostet werden.
which translates (using Google) to this:
Currently, you can invoke a Cloud Functions action through Watson Assistant instances hosted in the United States (South) or Germany regions.
If I switch to the English Version of the Documentation, this information disappears.

Client-side fan out data structure

I will implement my fan out model in Google's Firebase, but my question is only theoretical so the answer doesn't need to be in Firebase terms.
I am creating an app that I think should have a data structure similar to Tinder. The idea is only one post shows in your feed at a time; you then accept it or reject it and another one pops up and so on. My question is how exactly to structure the data so that it remains fast when the app scales up.
What I have right now is one node called "Posts" that contains every post that has ever been made. The app then queries for a post which is checked against the user Node of "viewedPosts" so that if the queried post has already been accepted/rejected by the user another one is queried until an unseen one is found. This obviously isn't a great solution because if there are a lot of posts, a query through them will be slow (especially if a lot of them have already been seen and the query has to be repeated multiple times).
I came across this article: The Firebase Blog: Client-side fan-out for data consistency which gave me the idea of creating a node inside each user which is "unseen posts" and every time a new post is uploaded by someone, to put it in the unseen folder for every user. This solves the problem on the side of the viewer, but to upload, one would have to download the list of all users in the app and then write to every single one of them.
So the question is, is there a middle ground between these which I can use to accurately do this?
Thank you.
EDIT:
Someone asked for my data structure:
{
"posts": {
"jkldsahjfkds": {
"title": "Simple Post",
"description": "This is my first post",
"numberOfImages": "2",
"price": "14.99",
"timestamp": "51782345",
"postedBy": "-hjd673bbewi7n",
"name": "Ryan Jacobs"
}
"-nisd7enskwes" : {...}
"-asdjfhk7385i" : {...}
"-sdfh49506ndk" : {...}
}
"users": {
"user1": {
"postsViewed": {
"-nisd7enskwes": 51784645,
"-sdfh49506ndk": 51782329
}
"postsLiked": {
"-sdfh49506ndk": 51782329
}
"userData": {
"name": "Albert Jones",
"bio": "Hi! Jow is everyone doing!?",
"location": "London"
}
}
}
}

How do I perform specific parentless requests using Restangular in a neat way?

Say I have an API endpoint at /users and another one at /cars. Naturally, a GET request to either of them will get all users or cars available. Now, a GET /users/74/cars should return all cars belonging to user 74.
But my app has many models related to cars, not just users, so more endpoints exist like /shops/34/cars and /mechanics/12/cars. For simplicity, I want all PUT/PATCH requests to be made to the main /cars endpoint.
At the moment of performing the save, Restangular will by default do a PUT request to the endpoint through which the item was loaded. But that endpoint do not exist.
It also provides a nice Restangular.setParentless(['cars']) method that will discard the first part of the url. However, I don't want to do this globally, but specifically for a particular element.
The neatest would actually do it globally, but restrict it for a specific method, like: Restangular.setParentless(['cars'], ['PUT']).
Anything like that around? Or am I overcomplicating it?
So far I tried stuff I don't like:
delete car.parentResource;
I would recommend using self reference links. A self reference link is a link which stores the route which should be used for GET/PUT/DELETE etc. on the item, rather than the URL from which it was pulled.
Example, update the mileage on one of user id 74's cars:
First, configure Restangular to look for a self link property called 'self' on each object.
RestangularProvider.setRestangularFields({
selfLink: 'self'
});
Next, make your call to get the cars. I'll assume that you have already modified your API to return a property called 'self' on each object that has the URL to it's proper API endpoint.
GET /users/74/cars
[
{
"id": 12,
"model": "Camaro",
"make": "Chevrolet",
"year": 1969,
"color": "red",
"odometer": 67294,
"license": "ABC12345",
"self": "/cars/12"
},
{
"id": 14,
"model": "Gallardo",
"make": "Lamborghini",
"year": 2015,
"color": "black",
"odometer": 521,
"license": "XYZ34567",
"self": "/cars/14"
}
]
We want to add some miles to one of them, and then save it. The entire Restangular code would look like:
Restangular.one('users', 74).all('cars').getList().then(function(cars){
cars[1].odometer = 613;
cars[1].put();
});
The PUT will go to /cars/14 instead of /users/74/cars/14. This is very useful for applications like yours that relate models as a graph rather than a strict hierarchical tree.

Json array Result format and display

Hi I have got the following method which fetches the JSON data
$("#Result").click(function () {
$.ajax({
type: "POST",
url: "SampleWebForm.aspx/FetchLibraryDetails",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
// Replace the div's content with the page method's return.
$("#Result").text(msg.resources.description.title);
}
});
});
The JSON result from the call is as below
LibraryData{
"resources": {
"description": {
"title": "Getting started with the online library",
"body": "The online library contains amazing resources and can seem overwhelming. This guide gives a very basic introduction. Over your years of study with us you will learn a lot more about resources and how to find and manage them.",
"image": "http:\/\/www.testWebsite.com\/library\/files\/library\/imagecache\/node_standard\/web-journal%20shelves.JPG",
"link": "http:\/\/www.testWebsite.com\/library\/node\/91194"
},
"items": [{
"title": "Large-scale open innovation: open source vs. patent pools",
"body": "Thierry Rayna (2010), 'Large-scale open innovation: open source vs. patent pools', International Journal of Technology Management, vol. 52, no. 3\/4, pp:477-0",
"image": "http:\/\/www.testWebsite.com\/libraryservices\/covers\/?id=0140-6736",
"link": "http:\/\/www.testWebsite.com\/libraryservices\/resource\/article:7477"
},
{
"title": "Introduction to Library Services",
"body": "A great introductory session that will explore the online library. You will know how to find information in your subject and be shown some key resources and services to help with your studies.",
"image": "http:\/\/www.testWebsite.com\/library\/files\/library\/imagecache\/node_standard\/web-journal%20shelves.JPG",
"link": "http:\/\/www.testWebsite.com\/library\/node\/97689"
}]
},
"access": {
"items": [{
"title": "Large-scale open innovation: open source vs. patent pools",
"body": "Thierry Rayna (2010), 'Large-scale open innovation: open source vs. patent pools', International Journal of Technology Management, vol. 52, no. 3\/4, pp:477-0",
"image": "http:\/\/www.testWebsite.com\/libraryservices\/covers\/?id=0140-6736",
"link": "http:\/\/www.testWebsite.com\/libraryservices\/resource\/article:7477"
},
{
"title": "Getting started with the online library",
"body": "The online library contains amazing resources and can seem overwhelming. This guide gives a very basic introduction. Over your years of study with us you will learn a lot more about resources and how to find and manage them.",
"image": "http:\/\/www.testWebsite.com\/library\/files\/library\/imagecache\/node_standard\/web-journal%20shelves.JPG",
"link": "http:\/\/www.testWebsite.com\/library\/node\/91194"
}],
"description": {
"title": "Getting started with the online library",
"body": "The online library contains amazing resources and can seem overwhelming. This guide gives a very basic introduction. Over your years of study with us you will learn a lot more about resources and how to find and manage them.",
"image": "http:\/\/www.testWebsite.com\/library\/files\/library\/imagecache\/node_standard\/web-journal%20shelves.JPG",
"link": "http:\/\/www.testWebsite.com\/library\/node\/91194"
}
},
"search": {
"items": [{
"title": "Large-scale open innovation: open source vs. patent pools",
"body": "Thierry Rayna (2010), 'Large-scale open innovation: open source vs. patent pools', International Journal of Technology Management, vol. 52, no. 3\/4, pp:477-0",
"image": "http:\/\/www.testWebsite.com\/libraryservices\/covers\/?id=0140-6736",
"link": "http:\/\/www.testWebsite.com\/libraryservices\/resource\/article:7477"
},
{
"title": "Getting started with the online library",
"body": "The online library contains amazing resources and can seem overwhelming. This guide gives a very basic introduction. Over your years of study with us you will learn a lot more about resources and how to find and manage them.",
"image": "http:\/\/www.testWebsite.com\/library\/files\/library\/imagecache\/node_standard\/web-journal%20shelves.JPG",
"link": "http:\/\/www.testWebsite.com\/library\/node\/91194"
}],
"description": {
"title": "Getting started with the online library",
"body": "The online library contains amazing resources and can seem overwhelming. This guide gives a very basic introduction. Over your years of study with us you will learn a lot more about resources and how to find and manage them.",
"image": "http:\/\/www.testWebsite.com\/library\/files\/library\/imagecache\/node_standard\/web-journal%20shelves.JPG",
"link": "http:\/\/www.testWebsite.com\/library\/node\/91194"
}
},
"helpdesk": {
"items": [{
"title": "Large-scale open innovation: open source vs. patent pools",
"body": "Thierry Rayna (2010), 'Large-scale open innovation: open source vs. patent pools', International Journal of Technology Management, vol. 52, no. 3\/4, pp:477-0",
"image": "http:\/\/www.testWebsite.com\/libraryservices\/covers\/?id=0140-6736",
"link": "http:\/\/www.testWebsite.com\/libraryservices\/resource\/article:7477"
},
{
"title": "Getting started with the online library",
"body": "The online library contains amazing resources and can seem overwhelming. This guide gives a very basic introduction. Over your years of study with us you will learn a lot more about resources and how to find and manage them.",
"image": "http:\/\/www.testWebsite.com\/library\/files\/library\/imagecache\/node_standard\/web-journal%20shelves.JPG",
"link": "http:\/\/www.testWebsite.com\/library\/node\/91194"
}],
"description": {
"title": "Getting started with the online library",
"body": "The online library contains amazing resources and can seem overwhelming. This guide gives a very basic introduction. Over your years of study with us you will learn a lot more about resources and how to find and manage them.",
"image": "http:\/\/www.testWebsite.com\/library\/files\/library\/imagecache\/node_standard\/web-journal%20shelves.JPG",
"link": "http:\/\/www.testWebsite.com\/library\/node\/91194"
}
}
}
My Question
Basically I am getting a set of JSON data (as above) on to the "data" object.
While debugging I can see the whole json data in the "data" object and can write on to a div tag using “data.d”
But I want to display the data separately from the JSON result Like
4 DIVs resources, access, search & helpdesk.
Under each of these I want to display the corresponding Description and items (each having title, body, image and link).
You have several different options, you can loop through the json object and hand roll some html to do what you want.
or - a much better way would be to use a library that supports templates like Knockout or Angular
If all you need is templates I would go with something like Knockout
Check out the Note 2 example - Using "foreach" option with named template
I personally like Angular, however it may be overkill for your situation
You can iterate over your Object and append some HTML-Element with propertys or Key-Value-Pairs like:
for (var key in obj) {
// do something
if (obj.hasOwnProperty(key)) {
// do somthing else
}
}

Explanation of Ext.direct API

I'm trying to get a grip on Ext.direct. On the official page there is this description of the API:
The purpose of the API component of the Ext Direct stack is to output the method configurations for Ext Direct to create client-side stubs. By generating these proxy methods, we can seamlessly call server-side methods as if they were client-side methods without worrying about the interactions between the client and server-side.
I just don't quite get what it means by ...to output the method configurations for Ext Direct to create client-side stubs. Would someone care to explain what this means at a grassroots level?
This will make more sense if you look at the output from the api.php resource included in the following example.
Note that this is being loaded on the page as a <script/> tag, ie:
<script type="text/javascript" src="php/api.php"></script>
When you open the src link you'll see the following JavaScript being generated by server-side PHP (see block of javascript code below).
In other words, PHP is doing the bit where it ... output(s) the method configurations for Ext Direct to create client-side (ie JavaScript) stubs.
Now the next question you should be asking if you want to make sense of this is: Why bother generating client side JavaScript using server side PHP (or other language of choice)?.
Ext.ns("Ext.app");
Ext.app.REMOTING_API={
"url": "php\/router.php",
"type": "remoting",
"actions": {
"TestAction": [{
"name": "doEcho",
"len": 1
}, {
"name": "multiply",
"len": 1
}, {
"name": "getTree",
"len": 1
}, {
"name": "getGrid",
"len": 1
}, {
"name": "showDetails",
"params": [
"firstName",
"lastName",
"age"
]
}],
"Profile": [{
"name": "getBasicInfo",
"len": 2
}, {
"name": "getPhoneInfo",
"len": 1
}, {
"name": "getLocationInfo",
"len": 1
}, {
"name": "updateBasicInfo",
"len": 0,
"formHandler": true
}]
}
};
This seems to be mimicking the way a WSDL works in that it can provide a service description and list all the options available for quering. In other words: Ext.Direct API is taking a concept from SOAP and applying it to a Javascript setting.
The back-end contains the API so this is the easiest place to generate a service definition with all the method names and signatures. Once the Ext.Direct API method stubs are provided (in the back-end), the front-end Ext.Direct library will do the plumbing and turn these into actual functionality that can be queried and used in JavaScript. Much in the same way as SOAP proxy classes can be automatically generated (in PHP/C# or Java) using the WSDL.
Personally I think this is a bit too airy-fairy for my liking. Most APIs are pretty straight forward and trying to implement something akin to WSDL actually makes consumption a lot harder than it would be if you just talk to it directly.

Resources