# Accessing user data from a Discourse Forum API

**URL:** https://meta.discourse.org/t/accessing-user-data-from-a-discourse-forum-api/311248
**Category:** Development
**Tags:** rest-api
**Created:** [June 8, 2024, 12:39pm UTC](https://meta.discourse.org/t/accessing-user-data-from-a-discourse-forum-api/311248 "2024-06-08T12:39:43Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![EReeeN1208](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ereeen1208/32/423083_2.png) [@EReeeN1208](https://meta.discourse.org/u/EReeeN1208)
#### Post date: [June 8, 2024, 12:39pm UTC](https://meta.discourse.org/t/accessing-user-data-from-a-discourse-forum-api/311248/1 "2024-06-08T12:39:43Z")

</div>

Hello, I want to access the user data (summary.json) located at [https://www.chiefdelphi.com/u/ereeen1208/summary.json](https://www.chiefdelphi.com/u/ereeen1208/summary.json) using Nextjs typescript for a project. (chiefdelphi is a discourse forum for FRC) I’ve tried using multiple methods but each method results in an error or is unsuccessfull:

(In all examples, url = “[https://www.chiefdelphi.com/u/ereeen1208/summary.json](https://www.chiefdelphi.com/u/ereeen1208/summary.json)”)

Code that returns empty response:

```plaintext
const response = await fetch(url, {
            mode: "no-cors",
            method: "GET"
        })

```

Code that returns cors errors:

```plaintext
const response = await fetch(url, {
            mode: "cors",
            method: "GET"
})

```

```plaintext
const { data } = await axios.get(url);

```

Error for fetch():

Access to fetch at ‘[https://www.chiefdelphi.com/u/ereeen1208/summary.json](https://www.chiefdelphi.com/u/ereeen1208/summary.json)’ from origin ‘[http://localhost:3000](http://localhost:3000)’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.

Error for axios.get():

Access to XMLHttpRequest at ‘[https://www.chiefdelphi.com/u/unpicasso/summary.json](https://www.chiefdelphi.com/u/unpicasso/summary.json)’ from origin ‘[http://localhost:3000](http://localhost:3000)’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

What can I do to get the data from this url? Would I need to try a different web scraping method or add more parameters? Thanks.

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [June 8, 2024, 7:58pm UTC](https://meta.discourse.org/t/accessing-user-data-from-a-discourse-forum-api/311248/2 "2024-06-08T19:58:55Z")

</div>

hi @EReeeN1208 perhaps this might help?

> [@CORS issue with javascript frontend](https://meta.discourse.org/t/cors-issue-with-javascript-frontend/158039/2):
>
> I figured it out myself. I was in bad belief, that CORS policy is turned ON by default. I edited app.yml and added DISCOURSE\_ENABLE\_CORS=true, rebooted app and all works fine.
