# Sentiment Analysis API Not Working

**URL:** https://community.thunkable.com/t/sentiment-analysis-api-not-working/1176047
**Category:** Questions about Thunkable X
**Created:** [March 19, 2021, 1:33pm UTC](https://community.thunkable.com/t/sentiment-analysis-api-not-working/1176047 "2021-03-19T13:33:49Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![fatouwaprbj](https://avatars.discourse-cdn.com/v4/letter/f/3ab097/32.png) [@fatouwaprbj](https://community.thunkable.com/u/fatouwaprbj)
#### Post date: [March 19, 2021, 1:33pm UTC](https://community.thunkable.com/t/sentiment-analysis-api-not-working/1176047/1 "2021-03-19T13:33:49Z")

</div>

Hi!

I’ve been trying to use this [text sentiment analysis](https://dev.to/sharadcodes/free-sentiment-analysis-rest-api-for-the-community-3om0) API for my app, but every time I try to analyze a text, I get a response that says “undefined”.

This what my API credentials look like:

 ![Screen Shot 2021-03-19 at 1.30.43 PM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/0/f007d49dd161acab7c16f7ae5699748685a08743.png)

This is what my Blocks look like:

 ![Screen Shot 2021-03-19 at 1.31.07 PM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/0/403bdd18d8d8adfbbff94bfcf35e0164b2acaf37.png)

This is what I get on my app (on web and phone live testing):

 ![Screen Shot 2021-03-19 at 1.33.31 PM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/e/a/eac5239ce032b44acd66d4060c3d357efc813470.png)

This is the response from the API:

 ![Screen Shot 2021-03-19 at 1.31.39 PM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/a/5/a50b390894f5b1d52f5cbfed84b17875d250e59e.png)

I would be really grateful if anyone could tell me what I’m doing wrong and how I could fix the problem. Thanks!

---

<div class="post-metadata">

### Author: ![codeswept](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/codeswept/32/87755_2.png) [@codeswept](https://community.thunkable.com/u/codeswept)
#### Post date: [March 19, 2021, 1:37pm UTC](https://community.thunkable.com/t/sentiment-analysis-api-not-working/1176047/2 "2021-03-19T13:37:02Z")

</div>

There are quite a few problems with your code. To get started, watch @tatiang’s really helpful video on getting started with APIs. They may seem tricky at first, but you’ll soon get the hang of it.

> [@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: ![fatouwaprbj](https://avatars.discourse-cdn.com/v4/letter/f/3ab097/32.png) [@fatouwaprbj](https://community.thunkable.com/u/fatouwaprbj)
#### Post date: [March 19, 2021, 3:39pm UTC](https://community.thunkable.com/t/sentiment-analysis-api-not-working/1176047/4 "2021-03-19T15:39:18Z")

</div>

Thanks for the video, I watched it and it helped clear some of my questions! I still do have a question though. I’m not sure how to create a url from the documentation I have. I’ve used API’s before on my projects, but they have been GET requests with much simpler API’s. This one is a POST request with documentation that isn’t as clear, so I do know how to do it. Should I look for a different API, or am I just not doing it correctly.

---

<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 19, 2021, 3:53pm UTC](https://community.thunkable.com/t/sentiment-analysis-api-not-working/1176047/5 "2021-03-19T15:53:17Z")

</div>

I’ve done a lot with APIs in Thunkable and I still have not been able to get a POST command to work. I know it’s possible but I find it confusing and after hours of trial and error, I usually give up.

But actually, from the link you posted above, that API looks pretty straightforward. I always get stuck when I have to create a time-stamped authentication string. But that one is just asking for two simple headers. So probably not too bad!

See this topic: [Post header - SET HEADERS method](https://community.thunkable.com/t/post-header-set-headers-method/1172691/)

And [this post](https://community.thunkable.com/t/post-header-set-headers-method/1172691/9) in particular.

---

<div class="post-metadata">

### Author: ![fatouwaprbj](https://avatars.discourse-cdn.com/v4/letter/f/3ab097/32.png) [@fatouwaprbj](https://community.thunkable.com/u/fatouwaprbj)
#### Post date: [March 19, 2021, 5:47pm UTC](https://community.thunkable.com/t/sentiment-analysis-api-not-working/1176047/6 "2021-03-19T17:47:16Z")

</div>

Thanks for this!

I tried to make the changes but I keep getting error messages about generating code for blocks, and whenever I try to test it the app crashes.

This is what my code looks like currently with the error message:

 ![Screen Shot 2021-03-19 at 5.46.45 PM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/2/2/225579e67a534ece4744f350c391e4fb19c0e677.png)

Is there something in particular I’m doing wrong here?

---

<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 19, 2021, 6:53pm UTC](https://community.thunkable.com/t/sentiment-analysis-api-not-working/1176047/7 "2021-03-19T18:53:39Z")

</div>

You’ll need to isolate the cause of that error. It’s usually something like selecting the wrong kind of variable. Try disconnecting & re-connecting blocks to see when the error appears.

---

<div class="post-metadata">

### Author: ![fatouwaprbj](https://avatars.discourse-cdn.com/v4/letter/f/3ab097/32.png) [@fatouwaprbj](https://community.thunkable.com/u/fatouwaprbj)
#### Post date: [March 22, 2021, 9:53am UTC](https://community.thunkable.com/t/sentiment-analysis-api-not-working/1176047/8 "2021-03-22T09:53:07Z")

</div>

I found the problem, I think it was because I was putting quotes in the object, but this is what I have now, and everytime I test it my app crashes still. Am i wrong for putting the body text as an object?

 ![Screen Shot 2021-03-22 at 9.51.24 AM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/b/0/b0065a01f317afd6bd8580a9a544a6965d573265.png)

---

<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:25pm UTC](https://community.thunkable.com/t/sentiment-analysis-api-not-working/1176047/9 "2024-11-08T13:25:54Z")

</div>


