# Web api will not get values and save as variables

**URL:** <https://community.thunkable.com/t/web-api-will-not-get-values-and-save-as-variables/120679>\
**Category:** Questions about Thunkable X\
**Created:** [June 25, 2019, 7:22pm UTC](https://community.thunkable.com/t/web-api-will-not-get-values-and-save-as-variables/120679 "2019-06-25T19:22:13Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![eoinparkinson](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/eoinparkinson/32/143769_2.png) [@eoinparkinson](https://community.thunkable.com/u/eoinparkinson)\
**Post date:** [June 25, 2019, 7:22pm UTC](https://community.thunkable.com/t/web-api-will-not-get-values-and-save-as-variables/120679/1 "2019-06-25T19:22:13Z")

</div>

This is my code:

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

Anybody know why this might be?

All help is much appreciated.

---

<div class="post-metadata">

**Author:** ![CBVG](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/cbvg/32/32401_2.png) [@CBVG](https://community.thunkable.com/u/CBVG)\
**Post date:** [June 25, 2019, 7:42pm UTC](https://community.thunkable.com/t/web-api-will-not-get-values-and-save-as-variables/120679/2 "2019-06-25T19:42:51Z")

</div>

Without seeing what POSTS\_API is supposed to be getting, how can we even guess?

---

<div class="post-metadata">

**Author:** ![eoinparkinson](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/eoinparkinson/32/143769_2.png) [@eoinparkinson](https://community.thunkable.com/u/eoinparkinson)\
**Post date:** [June 25, 2019, 8:20pm UTC](https://community.thunkable.com/t/web-api-will-not-get-values-and-save-as-variables/120679/3 "2019-06-25T20:20:41Z")

</div>

i do apologise. here it is

[https://donegalnews.com/wp-json/wp/v2/posts?\_embed&per\_page=10&page=1](https://donegalnews.com/wp-json/wp/v2/posts?_embed&per_page=10&page=1)

---

<div class="post-metadata">

**Author:** ![eoinparkinson](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/eoinparkinson/32/143769_2.png) [@eoinparkinson](https://community.thunkable.com/u/eoinparkinson)\
**Post date:** [June 25, 2019, 8:21pm UTC](https://community.thunkable.com/t/web-api-will-not-get-values-and-save-as-variables/120679/4 "2019-06-25T20:21:50Z")

</div>

it works fine getting the values into a label, just not variable

---

<div class="post-metadata">

**Author:** ![CBVG](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/cbvg/32/32401_2.png) [@CBVG](https://community.thunkable.com/u/CBVG)\
**Post date:** [June 25, 2019, 9:41pm UTC](https://community.thunkable.com/t/web-api-will-not-get-values-and-save-as-variables/120679/5 "2019-06-25T21:41:14Z")

</div>

I cannot find a single instance of “exerpt” in the file.  
Is it possible that you are expecting a structure that is not compatible with what you are actually getting?

Which variables did you actually get assigned to a proper value, and which failed?

And how did you determine that the variables were not properly assigned?

---

<div class="post-metadata">

**Author:** ![eoinparkinson](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/eoinparkinson/32/143769_2.png) [@eoinparkinson](https://community.thunkable.com/u/eoinparkinson)\
**Post date:** [June 25, 2019, 9:50pm UTC](https://community.thunkable.com/t/web-api-will-not-get-values-and-save-as-variables/120679/6 "2019-06-25T21:50:42Z")

</div>

i put it into firebase, like imported the json into firebase to get a better view of it. Exerpt works fine though

---

<div class="post-metadata">

**Author:** ![eoinparkinson](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/eoinparkinson/32/143769_2.png) [@eoinparkinson](https://community.thunkable.com/u/eoinparkinson)\
**Post date:** [June 25, 2019, 9:50pm UTC](https://community.thunkable.com/t/web-api-will-not-get-values-and-save-as-variables/120679/7 "2019-06-25T21:50:55Z")

</div>

Its just the variables that are causing the issue

---

<div class="post-metadata">

**Author:** ![eoinparkinson](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/eoinparkinson/32/143769_2.png) [@eoinparkinson](https://community.thunkable.com/u/eoinparkinson)\
**Post date:** [June 25, 2019, 9:51pm UTC](https://community.thunkable.com/t/web-api-will-not-get-values-and-save-as-variables/120679/8 "2019-06-25T21:51:52Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![CBVG](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/cbvg/32/32401_2.png) [@CBVG](https://community.thunkable.com/u/CBVG)\
**Post date:** [June 25, 2019, 9:59pm UTC](https://community.thunkable.com/t/web-api-will-not-get-values-and-save-as-variables/120679/9 "2019-06-25T21:59:40Z")

</div>

It is spelled “excerpt”.  
Your code spells it “exerpt” without the “c”. No wonder you can’t find it.

Your problem is between the keyboard and the chair.

---

<div class="post-metadata">

**Author:** ![eoinparkinson](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/eoinparkinson/32/143769_2.png) [@eoinparkinson](https://community.thunkable.com/u/eoinparkinson)\
**Post date:** [June 25, 2019, 10:05pm UTC](https://community.thunkable.com/t/web-api-will-not-get-values-and-save-as-variables/120679/10 "2019-06-25T22:05:09Z")

</div>

I see that now. I do apologise. Thanks for the help.

And just wondering, dooes web api not work when one of the tags are spelt wrong?

Thanks again.

---

<div class="post-metadata">

**Author:** ![CBVG](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/cbvg/32/32401_2.png) [@CBVG](https://community.thunkable.com/u/CBVG)\
**Post date:** [June 25, 2019, 10:15pm UTC](https://community.thunkable.com/t/web-api-will-not-get-values-and-save-as-variables/120679/11 "2019-06-25T22:15:41Z")

</div>

I don’t know.  
It should be getting the info in, just that it cannot parse it, and returns empty handed.

If it was me doing that code, I would have gotten the “{get property 0 of object {get object from JSON (response)}}” and assign THAT to a local variable. That way, all the “get properties” are relative to a local variable that does not require multiple transformation – at present, your block is getting it 6 times, essentially doing the same formatting half a dozen times, and throwing all that processing away after extracting a different property; the same as closing a book each time you need to read the next page instead of just turning it.

---

<div class="post-metadata">

**Author:** ![eoinparkinson](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/eoinparkinson/32/143769_2.png) [@eoinparkinson](https://community.thunkable.com/u/eoinparkinson)\
**Post date:** [June 25, 2019, 10:18pm UTC](https://community.thunkable.com/t/web-api-will-not-get-values-and-save-as-variables/120679/12 "2019-06-25T22:18:32Z")

</div>

I am relatively new to this. How would I parse the data. I am unsure what you mean

---

<div class="post-metadata">

**Author:** ![CBVG](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/cbvg/32/32401_2.png) [@CBVG](https://community.thunkable.com/u/CBVG)\
**Post date:** [June 25, 2019, 10:26pm UTC](https://community.thunkable.com/t/web-api-will-not-get-values-and-save-as-variables/120679/13 "2019-06-25T22:26:53Z")

</div>

Have a variable called “propertyzero” that is set to “{get property 0 of object {get object from JSON (response)}}”.

Then each time after you have the sequence "get property whatever “{get property 0 of object {get object from JSON (response)}}” ", you have "get property whatever of “propertyzero”, which already contains the desired subset “property 0”.  
For instance, your last assignement block would read

set app data to get property date\_gmt of object propertyzero.

You could even make that more efficient still by having an \_embedded variable since you are calling this 3 times, or a property0\_of\_author since you are calling that twice.  
The idea is to make the program reuse bits that it already has worked on, instead of always making new ones from scratch.

---

<div class="post-metadata">

**Author:** ![eoinparkinson](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/eoinparkinson/32/143769_2.png) [@eoinparkinson](https://community.thunkable.com/u/eoinparkinson)\
**Post date:** [June 25, 2019, 10:29pm UTC](https://community.thunkable.com/t/web-api-will-not-get-values-and-save-as-variables/120679/14 "2019-06-25T22:29:03Z")

</div>

Okay. If i shared the project with you would you be able to quickly re arrange the blocks for me? sorry for hassling you.

---

<div class="post-metadata">

**Author:** ![eoinparkinson](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/eoinparkinson/32/143769_2.png) [@eoinparkinson](https://community.thunkable.com/u/eoinparkinson)\
**Post date:** [June 25, 2019, 10:29pm UTC](https://community.thunkable.com/t/web-api-will-not-get-values-and-save-as-variables/120679/15 "2019-06-25T22:29:21Z")

</div>

Just one set of blocks and i can do the rest

---

<div class="post-metadata">

**Author:** ![CBVG](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/cbvg/32/32401_2.png) [@CBVG](https://community.thunkable.com/u/CBVG)\
**Post date:** [June 25, 2019, 10:48pm UTC](https://community.thunkable.com/t/web-api-will-not-get-values-and-save-as-variables/120679/16 "2019-06-25T22:48:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![eoinparkinson](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/eoinparkinson/32/143769_2.png) [@eoinparkinson](https://community.thunkable.com/u/eoinparkinson)\
**Post date:** [June 25, 2019, 11:20pm UTC](https://community.thunkable.com/t/web-api-will-not-get-values-and-save-as-variables/120679/17 "2019-06-25T23:20:09Z")

</div>

That works great. Thank you!

---

<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, 12:13pm UTC](https://community.thunkable.com/t/web-api-will-not-get-values-and-save-as-variables/120679/18 "2024-11-08T12:13:15Z")

</div>


