• Nirmal Christopher 11
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 4
    Replies
Requirement :

In your Salesforce dev org, create a VF page where you can enter the name of a city. And on hitting "Fetch" button, it should fetch and display the current weather and 7 day forecast for that place.

Use Yahoo weather service API for getting the details.
https://developer.yahoo.com/weather/

this is the class I created

public class fetchweather{ public static HttpResponse makeGetCallout() { Http http = new Http(); HttpRequest request = new HttpRequest(); request.setEndpoint('https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20text%3D%22nome%2C%20ak%22)&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys'); request.setMethod('GET'); HttpResponse response = http.send(request); if (response.getStatusCode() == 200) { // Deserializes the JSON string into collections of primitive data types. Map<String, Object> results = (Map<String, Object>) JSON.deserializeUntyped(response.getBody()); system.debug(results ); } return null;

}

I called this fetch weather method in the visual force page with a controllers method. I am getting error

System.CalloutException: Unauthorized endpoint, please check Setup->Security->Remote site settings. endpoint = https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20text%3D%22nome%2C%20ak%22)&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys
Error is in expression '{!fetchdata}' in component <apex:commandButton> in page searchaccounts: Class.fetchweather.makeGetCallout: line 7, column 1
Class.searchAccounts.fetchdata: line 8, column 1

I know well that i am messed up with the end point URL.
Also I am not sure what to add in the remote site settings in the end point URL.

Can some one guide me how to do this??
Requirement :

While we wait for allocation confirmation, see if you can work on a small POC.

In your Salesforce dev org, create a VF page where you can enter the name of a city. And on hitting "Fetch" button, it should fetch and display the current weather and 7 day forecast for that place.

Use Yahoo weather service API for getting the details.
https://developer.yahoo.com/weather/

this is the class I created

public class fetchweather{
public static HttpResponse makeGetCallout() {
Http http = new Http();
HttpRequest request = new HttpRequest();
request.setEndpoint('https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20text%3D%22nome%2C%20ak%22)&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys');
request.setMethod('GET');
HttpResponse response = http.send(request);
if (response.getStatusCode() == 200) {

// Deserializes the JSON string into collections of primitive data types.
Map<String, Object> results = (Map<String, Object>) JSON.deserializeUntyped(response.getBody());
system.debug(results );
}
return null;
}

I called this fetch weather method in the visual force page with a controllers method. I am getting error

System.CalloutException: Unauthorized endpoint, please check Setup->Security->Remote site settings. endpoint = https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20text%3D%22nome%2C%20ak%22)&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys
Error is in expression '{!fetchdata}' in component <apex:commandButton> in page searchaccounts: Class.fetchweather.makeGetCallout: line 7, column 1
Class.searchAccounts.fetchdata: line 8, column 1

I know well that i am messed up with the end point URL.
Also I am not sure what to add in the remote site settings in the end point URL.

Can some one guide me how to do this??
 
Requirement :

In your Salesforce dev org, create a VF page where you can enter the name of a city. And on hitting "Fetch" button, it should fetch and display the current weather and 7 day forecast for that place.

Use Yahoo weather service API for getting the details.
https://developer.yahoo.com/weather/

this is the class I created

public class fetchweather{ public static HttpResponse makeGetCallout() { Http http = new Http(); HttpRequest request = new HttpRequest(); request.setEndpoint('https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20text%3D%22nome%2C%20ak%22)&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys'); request.setMethod('GET'); HttpResponse response = http.send(request); if (response.getStatusCode() == 200) { // Deserializes the JSON string into collections of primitive data types. Map<String, Object> results = (Map<String, Object>) JSON.deserializeUntyped(response.getBody()); system.debug(results ); } return null;

}

I called this fetch weather method in the visual force page with a controllers method. I am getting error

System.CalloutException: Unauthorized endpoint, please check Setup->Security->Remote site settings. endpoint = https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20text%3D%22nome%2C%20ak%22)&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys
Error is in expression '{!fetchdata}' in component <apex:commandButton> in page searchaccounts: Class.fetchweather.makeGetCallout: line 7, column 1
Class.searchAccounts.fetchdata: line 8, column 1

I know well that i am messed up with the end point URL.
Also I am not sure what to add in the remote site settings in the end point URL.

Can some one guide me how to do this??
Requirement :

While we wait for allocation confirmation, see if you can work on a small POC.

In your Salesforce dev org, create a VF page where you can enter the name of a city. And on hitting "Fetch" button, it should fetch and display the current weather and 7 day forecast for that place.

Use Yahoo weather service API for getting the details.
https://developer.yahoo.com/weather/

this is the class I created

public class fetchweather{
public static HttpResponse makeGetCallout() {
Http http = new Http();
HttpRequest request = new HttpRequest();
request.setEndpoint('https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20text%3D%22nome%2C%20ak%22)&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys');
request.setMethod('GET');
HttpResponse response = http.send(request);
if (response.getStatusCode() == 200) {

// Deserializes the JSON string into collections of primitive data types.
Map<String, Object> results = (Map<String, Object>) JSON.deserializeUntyped(response.getBody());
system.debug(results );
}
return null;
}

I called this fetch weather method in the visual force page with a controllers method. I am getting error

System.CalloutException: Unauthorized endpoint, please check Setup->Security->Remote site settings. endpoint = https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20text%3D%22nome%2C%20ak%22)&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys
Error is in expression '{!fetchdata}' in component <apex:commandButton> in page searchaccounts: Class.fetchweather.makeGetCallout: line 7, column 1
Class.searchAccounts.fetchdata: line 8, column 1

I know well that i am messed up with the end point URL.
Also I am not sure what to add in the remote site settings in the end point URL.

Can some one guide me how to do this??