# Help! All of my FEMA API projects stopped working since March 2

**URL:** https://community.thunkable.com/t/help-all-of-my-fema-api-projects-stopped-working-since-march-2/1141518
**Category:** Questions about Thunkable X
**Tags:** parse, bug, webapi, json
**Created:** [March 4, 2021, 5:20am UTC](https://community.thunkable.com/t/help-all-of-my-fema-api-projects-stopped-working-since-march-2/1141518 "2021-03-04T05:20:05Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![steve.farnsworth](https://avatars.discourse-cdn.com/v4/letter/s/ecb155/32.png) [@steve.farnsworth](https://community.thunkable.com/u/steve.farnsworth)
#### Post date: [March 4, 2021, 5:20am UTC](https://community.thunkable.com/t/help-all-of-my-fema-api-projects-stopped-working-since-march-2/1141518/1 "2021-03-04T05:20:05Z")

</div>

I have been working with the PRO version of Thunkable X for a few months now as part of a Social Good App unit for my 10th graders. I have been working with my students to figure out different APIs and I have developed a number of Starter Projects that show the students how to set up their coding for this. For some reason, all of my FEMA API projects stopped working since March 2. Is there something going on with Thunkable? They were working just fine a couple of days ago. Could there be an issue with FEMA?

I can set the API URL just fine. I send the API url to a web page and I get the data for the url just fine. That still works, but when I try to GET anything, the screen flashes, goes blank, and says I need to restart my project.

Here is one of the projects: [Thunkable](https://x.thunkable.com/copy/aabdbcf102dd91a487405189a5646e84)

Here’s an image of the code for this project:

 ![FEMA incidentBeginDate Code](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/3/2/328f9eb598069b6a6310f875b12b08279bef610c.png)

Again, all my different FEMA projects were working fine a couple days ago.

Any help would be great. My students are finishing their apps this week.

---

<div class="post-metadata">

### Author: ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)
#### Post date: [March 4, 2021, 5:31am UTC](https://community.thunkable.com/t/help-all-of-my-fema-api-projects-stopped-working-since-march-2/1141518/2 "2021-03-04T05:31:34Z")

</div>

You are not testing/checking the green `error` block. If there is an error in the API you wouldn’t know without checking the `error` block first before attempting to use the `response` block.

Refer to the following tutorial for better understanding of API error handling.

> [@API JSON Tutorial (Video)](https://community.thunkable.com/t/api-json-tutorial-video/1140575):
>
> Using APIs in Thunkable and understanding how to parse JSON to get certain data from the API response is both a popular and a difficult aspect of using Thunkable. It’s not so much difficult because of Thunkable but because every API url format is different, every API documentation is different, every JSON response is different, etc. In this video, I spend a lot of time talking you through some best practices. It’s not a quick tutorial because if you rush through setting up an API in Thunkable, …

---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [March 4, 2021, 5:50am UTC](https://community.thunkable.com/t/help-all-of-my-fema-api-projects-stopped-working-since-march-2/1141518/3 "2021-03-04T05:50:43Z")

</div>

I love to hear about this sort of thing. I teach Thunkable to my students, too, in an elective for 7th and 8th graders. The educator category is so quiet around here… but I know there are teachers lurking. 🙂

Thanks, @muneer, I do hope that my tutorial is helpful.

That URL is a little complicated to reconstruct but I think I got it:

```auto
https://www.fema.gov/api/open/v2/DisasterDeclarationsSummaries? $filter=declarationDate gt '2021-01-01T04:00:00.000z' and state eq 'CA' and incidentType eq 'Fire'&$inlinecount=allpages

```

(I chose the year 2001, the state CA, and ‘Fire’ for the incident type).

I always test the URL in a browser before I worry about what’s happening in Thunkable.

I get this JSON response from that url… so to answer your question, it seems like FEMA is still working. 😉

```auto
{"metadata":{"skip":0,"top":1000,"count":0,"filter":"declarationDate gt '2021-01-01T04:00:00.000z' and state eq 'CA' and incidentType eq 'Fire'","format":"json","metadata":true,"orderby":{},"select":null,"entityname":"DisasterDeclarationsSummaries","version":"v2","url":"/api/open/v2/DisasterDeclarationsSummaries?$filter=declarationDate%20gt%20%272021-01-01T04:00:00.000z%27%20and%20state%20eq%20%27CA%27%20and%20incidentType%20eq%20%27Fire%27&$inlinecount=allpages","rundate":"2021-03-04T05:46:18.301Z","DeprecationInformation":{"depDate":null,"deprecatedComment":"","depApiMessage":"","depNewURL":"","depWebMessage":""}},"DisasterDeclarationsSummaries": []}

```

When formatted, that looks like this:

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

You’re trying to get **object** → **metadata** → **count**. In my example, that value equals 0. You’re also trying to get **object** → **DisasterDeclarationsSummaries** → **[first list item]** → **incidentBeginDate**. In my example, that value is an empty array/list. So if I try to assign it to a label’s Text in Thunkable, I’m probably going to generate an error/crash.

This is why error checking is so important with APIs. You need to be prepared (FEMA term!) for missing or blank data such as that. And you should always check the green error block’s value. I use an If/else block in my projects to do that, which you can see starting at the 17:09 mark in the video @muneer linked to.

---

<div class="post-metadata">

### Author: ![steve.farnsworth](https://avatars.discourse-cdn.com/v4/letter/s/ecb155/32.png) [@steve.farnsworth](https://community.thunkable.com/u/steve.farnsworth)
#### Post date: [March 4, 2021, 5:53pm UTC](https://community.thunkable.com/t/help-all-of-my-fema-api-projects-stopped-working-since-march-2/1141518/4 "2021-03-04T17:53:39Z")

</div>

Thunkable support told me there is a bug in the GET API blocks. They just fixed it. So hard refresh or purge cache and you should be good. All of my projects are working now.

Thank you so much for all your help. I learned a lot about how to work with APIs which will help me in the future.

---

<div class="post-metadata">

### Author: ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)
#### Post date: [November 8, 2024, 1:29pm UTC](https://community.thunkable.com/t/help-all-of-my-fema-api-projects-stopped-working-since-march-2/1141518/5 "2024-11-08T13:29:05Z")

</div>


