# How to create nutrition app with ocr scanner?

**URL:** https://community.thunkable.com/t/how-to-create-nutrition-app-with-ocr-scanner/1113955
**Category:** Questions about Thunkable X
**Created:** [February 21, 2021, 5:28pm UTC](https://community.thunkable.com/t/how-to-create-nutrition-app-with-ocr-scanner/1113955 "2021-02-21T17:28:00Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![celebytes20212iy4](https://avatars.discourse-cdn.com/v4/letter/c/ba8739/32.png) [@celebytes20212iy4](https://community.thunkable.com/u/celebytes20212iy4)
#### Post date: [February 21, 2021, 5:28pm UTC](https://community.thunkable.com/t/how-to-create-nutrition-app-with-ocr-scanner/1113955/1 "2021-02-21T17:28:00Z")

</div>

Hi! I wanted help creating a nutrition app. I want my app to use an ocr scanner but instead of giving a decription i want the ocr scanner to read the image and let the user know if it is healthy or not.

---

<div class="post-metadata">

### Author: ![drted](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/drted/32/92694_2.png) [@drted](https://community.thunkable.com/u/drted)
#### Post date: [February 21, 2021, 11:19pm UTC](https://community.thunkable.com/t/how-to-create-nutrition-app-with-ocr-scanner/1113955/2 "2021-02-21T23:19:12Z")

</div>

The [FDA provides a REST API](https://fdc.nal.usda.gov/api-guide.html) which you can access via the Thunkable Web API component. The app would be complex, but the fundamentals would be

1. Read the bar code
2. Look up the code using the web API
3. Evaluate the nutritional information and assign healthy/not healthy
4. Display results to user.

Happy Thunking!

---

<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: [February 21, 2021, 11:37pm UTC](https://community.thunkable.com/t/how-to-create-nutrition-app-with-ocr-scanner/1113955/3 "2021-02-21T23:37:40Z")

</div>

I’m curious why you need OCR. I would also recommend using the product’s bar code instead. One of my students made a food allergy scanner app using the [Open Fast Food API](https://us.openfoodfacts.org/).

---

<div class="post-metadata">

### Author: ![choi\_beomgyu](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/choi_beomgyu/32/105994_2.png) [@choi\_beomgyu](https://community.thunkable.com/u/choi_beomgyu)
#### Post date: [February 22, 2021, 12:03am UTC](https://community.thunkable.com/t/how-to-create-nutrition-app-with-ocr-scanner/1113955/4 "2021-02-22T00:03:21Z")

</div>

It probably because it needs to recognize the bar-code.

---

<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: [February 22, 2021, 12:10am UTC](https://community.thunkable.com/t/how-to-create-nutrition-app-with-ocr-scanner/1113955/5 "2021-02-22T00:10:55Z")

</div>

I’ve always thought of OCR as a way to convert a photo of text to editable text. But maybe OCR also applies to barcodes?

Either way, Thunkable provides bar code support via the device’s camera.

---

<div class="post-metadata">

### Author: ![celebytes20212iy4](https://avatars.discourse-cdn.com/v4/letter/c/ba8739/32.png) [@celebytes20212iy4](https://community.thunkable.com/u/celebytes20212iy4)
#### Post date: [February 23, 2021, 1:46pm UTC](https://community.thunkable.com/t/how-to-create-nutrition-app-with-ocr-scanner/1113955/6 "2021-02-23T13:46:46Z")

</div>

Okay thank you! Are there any project examples I can view as a reference?

---

<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: [February 23, 2021, 1:55pm UTC](https://community.thunkable.com/t/how-to-create-nutrition-app-with-ocr-scanner/1113955/7 "2021-02-23T13:55:13Z")

</div>

I am also making a nutrition app that requires OCR scanner, and you can use Open OCR API. It’s works well.

---

<div class="post-metadata">

### Author: ![celebytes20212iy4](https://avatars.discourse-cdn.com/v4/letter/c/ba8739/32.png) [@celebytes20212iy4](https://community.thunkable.com/u/celebytes20212iy4)
#### Post date: [February 23, 2021, 2:04pm UTC](https://community.thunkable.com/t/how-to-create-nutrition-app-with-ocr-scanner/1113955/8 "2021-02-23T14:04:15Z")

</div>

Thanks, but I’m going to try to make it with the barcode scanner but I’m not sure how to insert the database.

---

<div class="post-metadata">

### Author: ![celebytes20212iy4](https://avatars.discourse-cdn.com/v4/letter/c/ba8739/32.png) [@celebytes20212iy4](https://community.thunkable.com/u/celebytes20212iy4)
#### Post date: [February 23, 2021, 3:06pm UTC](https://community.thunkable.com/t/how-to-create-nutrition-app-with-ocr-scanner/1113955/9 "2021-02-23T15:06:07Z")

</div>

Okay thank you! Are there any project examples I can view as a reference? I’m also not sure how to insert the database.

---

<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: [February 23, 2021, 3:23pm UTC](https://community.thunkable.com/t/how-to-create-nutrition-app-with-ocr-scanner/1113955/10 "2021-02-23T15:23:35Z")

</div>

I might be able to share something. If you’re not familiar with JSON/APIs, it’s a learning curve!

You can start with this in-depth tutorial:

> [@JSON / Object Tutorial](https://community.thunkable.com/t/json-object-tutorial/1085666):
>
> Working with JSON data is a common Thunkable Discussion topic. Here I will try to answer the most common questions and provide solutions to the most common problems. This tutiorial has six parts: [Basic JSON](https://community.thunkable.com/t/json-object-tutorial/1085666/2)[JSON Errors](https://community.thunkable.com/t/json-object-tutorial/1085666/)[Intermediate JSON](https://community.thunkable.com/t/json-object-tutorial/1085666/4)[Advanced JSON](https://community.thunkable.com/t/json-object-tutorial/1085666/5)[Firebase Realtime DB and Cloud Variables](https://community.thunkable.com/t/json-object-tutorial/1085666/6)[Web API](https://community.thunkable.com/t/json-object-tutorial/1085666/7) The companion project with all examples can be [found here](https://x.thunkable.com/projectPage/601efcc715209c1fd57a3921).

---

<div class="post-metadata">

### Author: ![celebytes20212iy4](https://avatars.discourse-cdn.com/v4/letter/c/ba8739/32.png) [@celebytes20212iy4](https://community.thunkable.com/u/celebytes20212iy4)
#### Post date: [February 23, 2021, 3:34pm UTC](https://community.thunkable.com/t/how-to-create-nutrition-app-with-ocr-scanner/1113955/11 "2021-02-23T15:34:17Z")

</div>

Thank you!

---

<div class="post-metadata">

### Author: ![celebytes20212iy4](https://avatars.discourse-cdn.com/v4/letter/c/ba8739/32.png) [@celebytes20212iy4](https://community.thunkable.com/u/celebytes20212iy4)
#### Post date: [February 25, 2021, 5:43pm UTC](https://community.thunkable.com/t/how-to-create-nutrition-app-with-ocr-scanner/1113955/13 "2021-02-25T17:43:15Z")

</div>

What blocks would I use to look up the code using the web API?

---

<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: [February 25, 2021, 5:54pm UTC](https://community.thunkable.com/t/how-to-create-nutrition-app-with-ocr-scanner/1113955/14 "2021-02-25T17:54:39Z")

</div>

@celebytes20212iy4 Please don’t post a question more than once. If you don’t receive a reply immediately, it may be for a variety of reason but someone will likely respond at some point.

If you feel the need to re-post, at least provide additional information about what you’ve found, what you’ve tried, and what you need.

---

<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: [February 25, 2021, 7:10pm UTC](https://community.thunkable.com/t/how-to-create-nutrition-app-with-ocr-scanner/1113955/15 "2021-02-25T19:10:14Z")

</div>

To get started with APIs, Google _api thunkable_. The documentation and videos there are going to provide you with examples. The specific blocks are usually – but not limited to – the Web API URL and Web API Get blocks.

Note that with the new drag-and-drop interface, you no longer add an API component from the Design tab. You add it from the Blocks tab:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/8/7/87d2876802fb2e54089188781a2e481d695f20af.png)

---

<div class="post-metadata">

### Author: ![celebytes20212iy4](https://avatars.discourse-cdn.com/v4/letter/c/ba8739/32.png) [@celebytes20212iy4](https://community.thunkable.com/u/celebytes20212iy4)
#### Post date: [February 25, 2021, 10:50pm UTC](https://community.thunkable.com/t/how-to-create-nutrition-app-with-ocr-scanner/1113955/16 "2021-02-25T22:50:35Z")

</div>

I already got the scanner arranged. But how do I do step #2. Look up the code using the web API?

---

<div class="post-metadata">

### Author: ![celebytes20212iy4](https://avatars.discourse-cdn.com/v4/letter/c/ba8739/32.png) [@celebytes20212iy4](https://community.thunkable.com/u/celebytes20212iy4)
#### Post date: [February 25, 2021, 11:50pm UTC](https://community.thunkable.com/t/how-to-create-nutrition-app-with-ocr-scanner/1113955/17 "2021-02-25T23:50:11Z")

</div>

I put in the url for the web api. But what do I need to put in for the rest, like the query parameters and the headers?

---

<div class="post-metadata">

### Author: ![celebytes20212iy4](https://avatars.discourse-cdn.com/v4/letter/c/ba8739/32.png) [@celebytes20212iy4](https://community.thunkable.com/u/celebytes20212iy4)
#### Post date: [February 25, 2021, 11:50pm UTC](https://community.thunkable.com/t/how-to-create-nutrition-app-with-ocr-scanner/1113955/18 "2021-02-25T23:50:57Z")

</div>

Sorry my bad.

---

<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: [February 25, 2021, 11:52pm UTC](https://community.thunkable.com/t/how-to-create-nutrition-app-with-ocr-scanner/1113955/19 "2021-02-25T23:52:38Z")

</div>

That all depends on the API you’re using and what the documentation specifies. But many APIs can be accessed in Thunkable using the URL block with all of the parameters, API key, etc. included… without the query or header or body blocks. What is the url you’re using?

---

<div class="post-metadata">

### Author: ![celebytes20212iy4](https://avatars.discourse-cdn.com/v4/letter/c/ba8739/32.png) [@celebytes20212iy4](https://community.thunkable.com/u/celebytes20212iy4)
#### Post date: [February 25, 2021, 11:55pm UTC](https://community.thunkable.com/t/how-to-create-nutrition-app-with-ocr-scanner/1113955/20 "2021-02-25T23:55:40Z")

</div>

I’m using the url from the fast food api [https://world.openfoodfacts.org/api/v0/product/737628064502.json](https://world.openfoodfacts.org/api/v0/product/737628064502.json)

---

<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: [February 26, 2021, 12:56am UTC](https://community.thunkable.com/t/how-to-create-nutrition-app-with-ocr-scanner/1113955/21 "2021-02-26T00:56:24Z")

</div>

It’s really helpful to have the full JSON response. Thanks for posting a url that provides that.

Since that particular url doesn’t require any API key, it’s actually fairly simple to set up in Thunkable.

In the Web API URL block, paste the url you shared above. In the Web API Get block, you’ll want to check the green error block and if it’s empty, you can then parse the information from the green response block.

Parsing JSON is **difficult** but there are lots of good examples on the forums. If there’s a specific data field you want to access, let me know and I can provide a screenshot of the blocks that would return that data.

[Next page](https://community.thunkable.com/t/how-to-create-nutrition-app-with-ocr-scanner/1113955.md?page=2)
