# \[Solved\] How do I set API Headers?

**URL:** <https://community.thunkable.com/t/solved-how-do-i-set-api-headers/2324504>\
**Category:** Questions about Thunkable X\
**Tags:** solved, webapi\
**Created:** [March 14, 2023, 10:22pm UTC](https://community.thunkable.com/t/solved-how-do-i-set-api-headers/2324504 "2023-03-14T22:22:01Z")\
**Posts on this page:** 15\
**Page:** 2

<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 16, 2023, 12:19am UTC](https://community.thunkable.com/t/solved-how-do-i-set-api-headers/2324504/22 "2023-03-16T00:19:15Z")

</div>

@matt_conroy

I tried a [different project](https://x.thunkable.com/copy/8bafe9cfcc0f9565fa680d47d92a8dd4) and virtually the same blocks and it worked fine with or without the variable:

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

**Preview:**

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

---

<div class="post-metadata">

**Author:** ![kartik14](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/kartik14/32/44782_2.png) [@kartik14](https://community.thunkable.com/u/kartik14)\
**Post date:** [March 16, 2023, 4:29am UTC](https://community.thunkable.com/t/solved-how-do-i-set-api-headers/2324504/23 "2023-03-16T04:29:11Z")

</div>

@tatiang @matt_toyntond361

Hi folks, this seems to be working on the actual JSON Matt has provided -

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

Output on my label -  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/a/8/a8b306ae5ac9e97073fb6c3510b2ff3383c7332b.png)

Just instead of giving the property’s path via text, we use the inbuilt list.first & another get property block. Let me know if this helps. Cheers!

---

<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 16, 2023, 8:22am UTC](https://community.thunkable.com/t/solved-how-do-i-set-api-headers/2324504/24 "2023-03-16T08:22:21Z")

</div>

Yes, it worked for me, too, just above your post, if I used a different project. So it wasn’t the JSON or the blocks we were using… it was some corruption in the projects. I’m still not clear why it didn’t work.

---

<div class="post-metadata">

**Author:** ![kartik14](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/kartik14/32/44782_2.png) [@kartik14](https://community.thunkable.com/u/kartik14)\
**Post date:** [March 16, 2023, 9:31am UTC](https://community.thunkable.com/t/solved-how-do-i-set-api-headers/2324504/25 "2023-03-16T09:31:09Z")

</div>

Ah ok. Personally I always use the blocks approach instead of text-based path, as it gives me a clear idea of the structure I’m dealing with. In conclusion both approaches work, its upon @matt_toyntond361 now to decide which one he’d like to go with. 🙂

---

<div class="post-metadata">

**Author:** ![matt\_toyntond361](https://avatars.discourse-cdn.com/v4/letter/m/a88e57/32.png) [@matt\_toyntond361](https://community.thunkable.com/u/matt_toyntond361)\
**Post date:** [March 16, 2023, 10:34am UTC](https://community.thunkable.com/t/solved-how-do-i-set-api-headers/2324504/26 "2023-03-16T10:34:44Z")

</div>

Thanks so much everyone, ill have a play using both ways to see if it works for me, sorry i couldnt reply any sooner but i had reached my reply limit in the forum as a new user last night

---

<div class="post-metadata">

**Author:** ![matt\_toyntond361](https://avatars.discourse-cdn.com/v4/letter/m/a88e57/32.png) [@matt\_toyntond361](https://community.thunkable.com/u/matt_toyntond361)\
**Post date:** [March 16, 2023, 11:33am UTC](https://community.thunkable.com/t/solved-how-do-i-set-api-headers/2324504/27 "2023-03-16T11:33:24Z")

</div>

Both, thank you so much that is working - really appreciate you giving up your time to help out !! For ref adding an image works just fine with notation was just the ingredient’s list.

@tatiang @kartik14 One final question, and ive tried googling this but is it possible to change the text colour of certain ingredients in Thunkable IE can i create a Data source of known bad ingredient’s and get these to display in RED i know this is off topic and can create a new post if thats better

---

<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 16, 2023, 2:09pm UTC](https://community.thunkable.com/t/solved-how-do-i-set-api-headers/2324504/28 "2023-03-16T14:09:14Z")

</div>

It’s probably best to create a new topic about your question. Yes, there are ways to do this, some easier than others.

---

<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 17, 2023, 2:48pm UTC](https://community.thunkable.com/t/solved-how-do-i-set-api-headers/2324504/29 "2023-03-17T14:48:27Z")

</div>

@matt_conroy @kartik14 I discovered something related to the JSON parsing issue. I noticed that if I use the variable `app variable ingredients to avoid list` in the `does list contain` block inside my loop, it crashes the project. If I use a static list of values in that block, it works fine.

Project link: [Thunkable](https://x.thunkable.com/copy/fcb4ffe7d4ae1898e212e24cf34c989d)

**These blocks work:**

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

**These blocks crash:**

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

**Using static text values in the `initialize variable` block also crashes:**

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/1/014dffbae6fb5029a60445b4da706d6b4c1f2388.png)

---

<div class="post-metadata">

**Author:** ![matt\_conroy](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/matt_conroy/32/150843_2.png) [@matt\_conroy](https://community.thunkable.com/u/matt_conroy)\
**Post date:** [March 17, 2023, 4:44pm UTC](https://community.thunkable.com/t/solved-how-do-i-set-api-headers/2324504/30 "2023-03-17T16:44:05Z")

</div>

@tatiang I’ll have to see what may going on here. Maybe @ioannis has an idea? You are correct though, when using the `does list contain` block, it returns the following in the console:  
`TypeError: Cannot read properties of undefined (reading 'indexOf')`

---

<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:** [March 17, 2023, 5:25pm UTC](https://community.thunkable.com/t/solved-how-do-i-set-api-headers/2324504/31 "2023-03-17T17:25:28Z")

</div>

it’s strange because this returns true

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

but this returns false!

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/6/a/6a6343a381fbda57f4486952fcde5bc2cb53f8f2.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:** [March 20, 2023, 1:23pm UTC](https://community.thunkable.com/t/solved-how-do-i-set-api-headers/2324504/32 "2023-03-20T13:23:18Z")

</div>

@tatiang I copied the same blocks into a new app and tested and there were no problems.  
[Thunkable](https://x.thunkable.com/projects/64184a22abfc5a752858d9cd/28897122-d23b-4e63-a5b6-00f7c89faddd/settings)

@manyone in your case, I think the second screenshot returns fault because is checking if is the same list and it should return fault because even if it contains the same items you have two lists

To understand that I tested this app  
[https://x.thunkable.com/projects/641859672ce3024e0a6ec216/cd71d271-dd56-41ce-a448-4ee96252daf6/blocks](https://x.thunkable.com/projects/641859672ce3024e0a6ec216/cd71d271-dd56-41ce-a448-4ee96252daf6/blocks)

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/8/0/8040240e928578d9ab1962c760655b5d7009af09.png)

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/8/5/851d87af824f7c17914e1dee83ca9ac9e7fe7f62.png)

---

<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:** [March 20, 2023, 4:20pm UTC](https://community.thunkable.com/t/solved-how-do-i-set-api-headers/2324504/33 "2023-03-20T16:20:34Z")

</div>

that sounds wrong! any object containing a value of, say 5, should match another object also containing the value 5!

this is ridiculous though - even this one is FALSE!  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/a/4a93dd82aad940118f058745cafa77d79426c5e3.png)

on the other hand we do have an \<is\_list\_empty\> block so we don’t have to compare a list to \<empty\_list\> to find out.

---

<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:** [March 22, 2023, 1:10pm UTC](https://community.thunkable.com/t/solved-how-do-i-set-api-headers/2324504/34 "2023-03-22T13:10:59Z")

</div>

@manyone If you want to compare 2 lists you will need to use the join block first

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/8/0/8023c19fac44cd5bcc2935770c94d789a88fbc93.png)

---

<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:** [March 22, 2023, 2:46pm UTC](https://community.thunkable.com/t/solved-how-do-i-set-api-headers/2324504/35 "2023-03-22T14:46:38Z")

</div>

I didn’t know you could do that! Thanks for the tip.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/f/0f59f292712368bce16ff80133ae10de8a6f27e8.png) [@system](https://community.thunkable.com/u/system)\
**Post date:** [June 20, 2023, 2:47pm UTC](https://community.thunkable.com/t/solved-how-do-i-set-api-headers/2324504/36 "2023-06-20T14:47:09Z")

</div>

Closed on June 20, 2023, 2:47pm UTC

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

[Previous page](https://community.thunkable.com/t/solved-how-do-i-set-api-headers/2324504.md?page=1)
