# Issue with using fetch to connect to API

**URL:** <https://community.angelcam.com/t/issue-with-using-fetch-to-connect-to-api/631>\
**Category:** Angelcam products & services\
**Created:** [May 17, 2022, 4:00pm UTC](https://community.angelcam.com/t/issue-with-using-fetch-to-connect-to-api/631 "2022-05-17T16:00:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Justin\_Lorenzo](https://avatars.discourse-cdn.com/v4/letter/j/9dc877/32.png) [@Justin\_Lorenzo](https://community.angelcam.com/u/Justin_Lorenzo)\
**Post date:** [May 17, 2022, 4:00pm UTC](https://community.angelcam.com/t/issue-with-using-fetch-to-connect-to-api/631/1 "2022-05-17T16:00:13Z")

</div>

I am able to use curl within my terminal to get my profile, camera list, and camera streams… however when I convert these into a fetch to be contacted from my NPM server I am receiving an http 200 status but a blank response on all API calls.  
This is the fetch request:

URL: [https://api.angelcam.com/v1/me/](https://api.angelcam.com/v1/me/)

```auto
const response = await fetch(
			url,
			{
				method: "GET", // *GET, POST, PUT, DELETE, etc.
				mode: "cors", // no-cors, *cors, same-origin
				headers: {
					"Authorization": `PersonalAccessToken ${this.apiKey}`,
					"Accept": "application/json",
					"Content-Type": "application/json",
				},
			}
		);
		return response;

```

---

<div class="post-metadata">

**Author:** ![Justin\_Lorenzo](https://avatars.discourse-cdn.com/v4/letter/j/9dc877/32.png) [@Justin\_Lorenzo](https://community.angelcam.com/u/Justin_Lorenzo)\
**Post date:** [May 17, 2022, 5:04pm UTC](https://community.angelcam.com/t/issue-with-using-fetch-to-connect-to-api/631/2 "2022-05-17T17:04:37Z")

</div>

It appears the issue is the response is not converted into json format first. This fix worked for me:

```auto
const json = await response.json()
return json

```

---

<div class="post-metadata">

**Author:** ![Pavel\_Kuba](https://sea2.discourse-cdn.com/flex016/user_avatar/community.angelcam.com/pavel_kuba/32/129_2.png) [@Pavel\_Kuba](https://community.angelcam.com/u/Pavel_Kuba)\
**Post date:** [May 18, 2022, 7:29am UTC](https://community.angelcam.com/t/issue-with-using-fetch-to-connect-to-api/631/3 "2022-05-18T07:29:55Z")

</div>

Justin, Thank you for sharing the solution with us all!
