# Understanding Simple API call

**URL:** <https://forum.kirupa.com/t/understanding-simple-api-call/643189>\
**Category:** programming\
**Created:** [June 5, 2020, 8:03pm UTC](https://forum.kirupa.com/t/understanding-simple-api-call/643189 "2020-06-05T20:03:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Umair\_Ashraf](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/umair_ashraf/32/11705_2.png) [@Umair\_Ashraf](https://forum.kirupa.com/u/Umair_Ashraf)\
**Post date:** [June 5, 2020, 8:03pm UTC](https://forum.kirupa.com/t/understanding-simple-api-call/643189/1 "2020-06-05T20:03:04Z")

</div>

Hi guys,

Currently i am trying to understand about the API calls, i am fetching the data and i understand it will return as a promise and that promise contains the data and on that JSON-data i can use .json to convert into object or arrays or object.

But in the browser i can only see this **[object Promise]** , i am just trying to understand the way to show the actual description, as it shows here as **Sunny**

Thanks in advance 🙂  
.

```
let x1 = document.getElementById('apicall')

async function abc(){

let apicall = await fetch('http://api.weatherstack.com/current?access_key=de129598ee099224e5736e25632c210c&query=New%20York')

console.log(apicall)

    let apidata= await apicall.json()

    console.log(apidata)

  // console.log(apidata.key)

console.log(apidata.current.weather_icons[0])

return apidata.current.weather_descriptions[0];

    }

let z1=abc()

x1.innerHTML=`<p>Weather: ${z1} </p>`

```

 ![wetherapp](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/2X/3/3379bec67c3fac11d1bcd5b7978f6bc4f4752dc0.jpeg)

---

<div class="post-metadata">

**Author:** ![senocular](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/senocular/32/7217_2.png) [@senocular](https://forum.kirupa.com/u/senocular)\
**Post date:** [June 5, 2020, 8:12pm UTC](https://forum.kirupa.com/t/understanding-simple-api-call/643189/2 "2020-06-05T20:12:12Z")

</div>

async functions always return a promise, even if you return a non-promise value from within them. If a non-promise is returned, its wrapped in a promise. As a result, you always have to wait for that promise to resolve to get its value.

```javascript
abc()
  .then(z1 => {
    x1.innerHTML=`<p>Weather: ${z1} </p>`
  });

```
