Connecting with openweathermap API doe not work


I am trying to connect with weather forecast API for Pune city using DF’s Remote Service Configuration, but seems to be not working.

My remote rest URL is<app_key>

I create a Pune Weather Forecast API named as “pw”. Then in Config tab I added base URL up to …/forecast. In Config tab, I added two parameters as following:

When I request MY URL as “http://localhost:8080/api/v2/pw/” I get error saying, “This site can’t be reached, localhost refused to connect”

Please guide me so that I can create an API in DF that connects with remote API for “Weather Forecast”



Hi @nimesht,

I just replied to your ticket on our support channel but wanted to post my answer here as well for anyone else trying to configure this.

  1. Created an API key with
  2. Setup my application service:
  3. Tested it in our own testing environment (test_rest.html; every DF instance has this built into it)
  4. Tested in Postman as well with basic auth:

Let me know if you are still having issues.




Hi Erik,

Thank you for sharing all screenshots as well which really helped me. Now, I am able to connect this Open Weather API.

I would like to add here for benefit of others that I wanted to create an API in dream factory that provides weather for my city. Hence, I also added outgoing parameter as “id=1259229” so that I do not have to add “id=1259229” as url parameter to my rest api call and that also worked for me


Just wanted to find out if we can add pre and post script for dream factory api that connects with remote rest api? In our example, I am trying to add pre and post script logic to http://localhost:8080/api/v2/pw/

I went to “Scripts” tab and clicked on “pw”, but I got blank screen on left side where we normally get options to choose pre and post script for any other rest api.

Does this issue have any connection with “Service Definitions” for my API? Because I have not provided any service definition yet.


So glad you got it working, @nimesht!

That is correct. You need to have service definitions in order to script against the 3rd party service in the front-end interface of DreamFactory. You can use the endpoints in an app and include scripting within an application, you just cannot do it in DreamFactory until you have service definitions in place.

Here are a couple of editors:




I gave service definition and I could see options to add PRE and POST service logic for GET, POST, PUT, etc under “Scripts” tab.

Now, I would like to add simple PRE logic for GET API, in which my GET API receives city=Pune from url parameter, but PRE script translate city=Pune to id=1259229 for Open Weather Map API. Then I will also like to add hateoas links to outgoing response(adding “links” attribute which would be array). How would I access base URL of remote service(that I configured in my dream factory service) in my pre and post script?

In short, I am trying to learn how I add logic in which I modify outgoing request to Open Weather Map API and then also modify response.

I will greatly appreciate pointer hints using V8 JS.