# Can't load API data

**URL:** <https://discourse.processing.org/t/cant-load-api-data/26722>\
**Category:** Beginners\
**Created:** [January 3, 2021, 2:35pm UTC](https://discourse.processing.org/t/cant-load-api-data/26722 "2021-01-03T14:35:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chudroy](https://avatars.discourse-cdn.com/v4/letter/c/e47774/32.png) [@Chudroy](https://discourse.processing.org/u/Chudroy)\
**Post date:** [January 3, 2021, 2:35pm UTC](https://discourse.processing.org/t/cant-load-api-data/26722/1 "2021-01-03T14:35:05Z")

</div>

```auto
  function setup() { 
  createCanvas(400, 400);
  var url = "http://api.openweathermap.org/data/2.5/weather?q=London&appid= ______ &units=metric"
  loadJSON(url);
}

```

Hi! When I try to load JSON data from this weather API, I get this error:

**Uncaught TypeError: Cannot read property ‘split’ of undefined (: line 56)**

I can’t find anything in the reference, and in this video on The Coding Train which I’m following, I can’t see any difference between what Mr Shiffman is doing and what I’m doing.

video: [https://youtu.be/ecT42O6I\_WI](https://youtu.be/ecT42O6I_WI)

I have tried passing the string in as an argument directly, as a variable such as in the code; specifying “jason” and “jasonp” in the datatype, using preload, and generally fumbled about.

I have also tried pasting the address into the URL bar and that does work.

Does anyone have any idea?

I have omitted the API key for privacy.

Thanks!

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [January 3, 2021, 3:05pm UTC](https://discourse.processing.org/t/cant-load-api-data/26722/2 "2021-01-03T15:05:19Z")

</div>

[p5js.org/reference/#/p5/preload](http://p5js.org/reference/#/p5/preload)  
[p5js.org/reference/#/p5/loadJSON](http://p5js.org/reference/#/p5/loadJSON)

> **[OpenWeatherMapJSON](https://Bl.ocks.org/GoSubRoutine/5fbc03e019c53254a2ba7e7fd3318b45)**
>
> GoSubRoutine’s Block 5fbc03e019c53254a2ba7e7fd3318b45

---

<div class="post-metadata">

**Author:** ![Chudroy](https://avatars.discourse-cdn.com/v4/letter/c/e47774/32.png) [@Chudroy](https://discourse.processing.org/u/Chudroy)\
**Post date:** [January 3, 2021, 4:03pm UTC](https://discourse.processing.org/t/cant-load-api-data/26722/3 "2021-01-03T16:03:43Z")

</div>

I have managed to solve the problem by manually changing the “http” element to “https”.
