I found my username and password in IBM Cloud Docs Weather.

I have this code:

print file_get_contents("https://d40845df-8125-441f-8e7c-e650726ce721:[email protected]/v1/location/30339:4:US/forecast/hourly/48hour.json");
// of course, the password is my password

The result on my website is Unauthorized.Array()

What's wrong?

I can go to Weather API on https://twcservice.mybluemix.net/rest-api/ and here is clickable API for weather.

It looks like this:

enter image description here
enter image description here

When I fill empty inputs and click on Try it out! I get no response.

enter image description here

On IBM Cloud Docs Weather I found username and password with GET url.

enter image description here

1 Answers

1
Volmarg Reiso On

Looks like they require some authorization after all.

curl -X GET --header 'Accept: application/json' 'https://twcservice.mybluemix.net/api/weather/v1/geocode/33.40/-83.42/forecast/hourly/48hour.json'

I've ran the curl in linux terminal and got unathorized.

Same when You try to enter the url directly in browser.

Looking on this: http://www.remkohde.com/2016/11/14/add-serverless-programming-and-data-integration-on-bluemix/

I think You do need some authorization:

curl -X GET "https://<username>:<password>@twcservice.mybluemix.net/api/weather/v1/geocode/33.40/-83.42/forecast/daily/10day.json?units=m&language=en-US"

I think that the api might be outdated or something since even the online test returns strange response code 0.