# Help needed - API

**URL:** <https://forum.freecodecamp.org/t/help-needed-api/129635>\
**Category:** General\
**Created:** [June 20, 2017, 3:42pm UTC](https://forum.freecodecamp.org/t/help-needed-api/129635 "2017-06-20T15:42:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![adist98](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/adist98/32/161055_2.png) [@adist98](https://forum.freecodecamp.org/u/adist98)\
**Post date:** [June 20, 2017, 3:42pm UTC](https://forum.freecodecamp.org/t/help-needed-api/129635/1 "2017-06-20T15:42:53Z")

</div>

Guys i am stuck on the projects using API,i am done with basic algo and honestly i had no problem, but since the projects use API, i need sources to understand it.  
if you had the same problem, please share how you coped up with it.  
Thanks

---

<div class="post-metadata">

**Author:** ![Oxyrus](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/oxyrus/32/69509_2.png) [@Oxyrus](https://forum.freecodecamp.org/u/Oxyrus)\
**Post date:** [June 20, 2017, 3:53pm UTC](https://forum.freecodecamp.org/t/help-needed-api/129635/2 "2017-06-20T15:53:43Z")

</div>

Hmm, I don’t remember how I learned to use APIs but here is how it works.

1. You do a request to the API, you can use the [fetch API](https://developer.mozilla.org/en/docs/Web/API/Fetch_API), [axios](https://github.com/mzabriskie/axios) or even [jQuery](https://api.jquery.com/jquery.get/) (among other libraries).
2. You get either a successful response or an error, you should handle both cases, for instance if you use axios it would look like this:

```auto
axios.get(url)
  .then(res => {
    console.log("This was a successful response, here is the data")
    console.log(res.data) 
  })
  .catch(err => {
    console.error(err)
  })

```

You have to keep in mind, almost all of the API responses will be an object that contains a data property, inside the data you find what you’ve asked for.

You can save the data in a variable and start working with it in your application.

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [January 17, 2021, 8:55pm UTC](https://forum.freecodecamp.org/t/help-needed-api/129635/3 "2021-01-17T20:55:34Z")

</div>

Closed on January 17, 2021, 8:55pm UTC


