# \[Solved\] Project won't GET data from API in Web Preview \[CORS issue\]

**URL:** <https://community.thunkable.com/t/solved-project-wont-get-data-from-api-in-web-preview-cors-issue/1888743>\
**Category:** Web API's\
**Tags:** beginner, webapi\
**Created:** [May 22, 2022, 12:47pm UTC](https://community.thunkable.com/t/solved-project-wont-get-data-from-api-in-web-preview-cors-issue/1888743 "2022-05-22T12:47:12Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![manyone](https://avatars.discourse-cdn.com/v4/letter/m/ee59a6/32.png) [@manyone](https://community.thunkable.com/u/manyone)\
**Post date:** [May 23, 2022, 6:15am UTC](https://community.thunkable.com/t/solved-project-wont-get-data-from-api-in-web-preview-cors-issue/1888743/5 "2022-05-23T06:15:07Z")

</div>

i found a way to get around “cannot GET” errors in webapi (due to CORS - cross origin issue). the answer is [**allOrigins**](https://allorigins.win/) whose catch phrase is " Pull contents from any page via API (as JSON/P or raw) and avoid Same-origin policy problems."

the original problem started because of this behavior:

the link below works in a browser and also works in Postman but does NOT work in Thunkable (due to CORS issues apparently)

`http://numbersapi.com/2000/year?json`

this is the result from a browser:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/6/d/6db1de23eee0f6b9128363767733037f8220c487.png)

but when coded in thunkable, it returns with a response “cannot GET”.

Error
```
Cannot GET /web-build/numbersapi.com/2000/year
```

however if you use **allOrigins** , you code the url like this:

`https://api.allorigins.win/get?url=http://numbersapi.com/2000/ye`ar?json

Below is what it looks like when it is entered from a browser. note how the desired url is included in the call. also note that the response of the desired url is now contained as a json variable called **contents**.

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/a/2/a223b50e86e468fb76ed0236799324b487b19fbd.png)

this is how to code it in thunkable. (notice the nested json processing)\>

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/1/2/12c6d5aa779ae32f2db2e762f9940f221c2c78d2.png)

with this result (each successive call gives a different result for the same year)

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/3/f3a657b3577af1692c038e8f90b87144b9865ddb.png)

here’s the project link  
[https://x.thunkable.com/copy/377e3ddfcfb3e3ae9ba9ce18033d1aca](https://x.thunkable.com/copy/377e3ddfcfb3e3ae9ba9ce18033d1aca)

---

_[View the full topic](https://community.thunkable.com/t/solved-project-wont-get-data-from-api-in-web-preview-cors-issue/1888743)._
