# Why am I not able to see the values that was posted in form

**URL:** <https://community.postman.com/t/why-am-i-not-able-to-see-the-values-that-was-posted-in-form/52114>\
**Category:** Help Hub\
**Tags:** development, json, python\
**Created:** [September 20, 2023, 8:28pm UTC](https://community.postman.com/t/why-am-i-not-able-to-see-the-values-that-was-posted-in-form/52114 "2023-09-20T20:28:09Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![lunar-module-sagani1](https://avatars.discourse-cdn.com/v4/letter/l/c0e974/32.png) [@lunar-module-sagani1](https://community.postman.com/u/lunar-module-sagani1)\
**Post date:** [September 20, 2023, 8:28pm UTC](https://community.postman.com/t/why-am-i-not-able-to-see-the-values-that-was-posted-in-form/52114/1 "2023-09-20T20:28:09Z")

</div>

This is my code # import main Flask class and request object

```auto
from email.mime import application
from flask import Flask, request

# create the Flask app
application=Flask( __name__ )

# allow both GET and POST requests
@application.route('/', methods=['GET', 'POST'])
def form_example():
    # handle the POST request
    if request.method == 'POST':
        key = request.form.get('key') # Retrieve the 'key' parameter
        name = request.form.get('name') # Retrieve the 'name' parameter
        attachment = request.form.get('attachment') # Retrieve the 'attachment' parameter
        description = request.form.get('description') # Retrieve the 'description' parameter
        return '''
                  <h1>Key: {}</h1>
                  <h1>Name: {}</h1>
                  <h1>Attachment: {}</h1>
                  <h1>Description: {}</h1>
                '''.format(key, name, attachment, description)

    # otherwise handle the GET request
    return '''
           <form method="POST">
               <div><label>key: <input type="text" name="key"></label></div>
               <div><label>name: <input type="text" name="name"></label></div>
               <div><label>attachment: <input type="text" name="attachment"></label></div>
               <div><label>description: <input type="text" name="description"></label></div>
               <input type="submit" value="Submit">
           </form>'''

if __name__ == ' __main__':
    # run app in debug mode on port 5000
    application.run()

```

and I want to see the values that was posted in the form I tried using json but I was just seeing none. this was my json code

```auto
{
    "Key": "${Project}",
    "Name": "${Name}",
    "Attachment":"${Attachment}",
    "Description" : "${Description}"
}

```

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/3/4/34fac426664ece51a9071f68917bf86e1ae0181e.png)  
 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/4/5/45604b8784ad860460062e9691c8dcd8218b3b73.png)

---

<div class="post-metadata">

**Author:** ![amit](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/amit/32/2056_2.png) [@amit](https://community.postman.com/u/amit)\
**Post date:** [September 21, 2023, 4:52am UTC](https://community.postman.com/t/why-am-i-not-able-to-see-the-values-that-was-posted-in-form/52114/2 "2023-09-21T04:52:52Z")

</div>

Hey @lunar-module-sagani1👋 Welcome to Postman community!

**I’ve spotted quite a few issues with the entire setup.**

- In your python code you are expecting form-data, while you are sending JSON payload from Postman
- [Postman encloses variables](https://learning.postman.com/docs/sending-requests/variables/) within two curly braces `{{variable}}`, you are incorrectly using `${Project}`
- You are using all lower case when fetching data in your python code, but the keys in use on Postman have the first letter capitalized: `Key` vs `key`

**The easiest fix would be to update your Postman request to use form-data**  
**Example:**

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/b/a/bad129c6fb6663fe5349867df8fd95e9dd7a5d9e.png)

**Also make sure that you are setting some value inside the variables**  
I’ve setting some test data inside [pre-request script](https://learning.postman.com/docs/writing-scripts/pre-request-scripts/) as follows:

 ![Screenshot 2023-09-21 at 4.48.45 PM](https://us1.discourse-cdn.com/getpostman/original/3X/2/5/25e39384a55de84ffac4d91f5aa6a91b8a334169.png)

Here’s my quick test results using `form-data` and setting variable value in pre-request script, and the code you provided.

 ![Screenshot 2023-09-21 at 4.50.29 PM](https://us1.discourse-cdn.com/getpostman/original/3X/7/f/7fe17d0440904fcd1dd0b20c0a59258fcf8c8ec5.png)

---

<div class="post-metadata">

**Author:** ![lunar-module-sagani1](https://avatars.discourse-cdn.com/v4/letter/l/c0e974/32.png) [@lunar-module-sagani1](https://community.postman.com/u/lunar-module-sagani1)\
**Post date:** [September 21, 2023, 4:21pm UTC](https://community.postman.com/t/why-am-i-not-able-to-see-the-values-that-was-posted-in-form/52114/3 "2023-09-21T16:21:39Z")

</div>

That works but how do I pull the values that was posted in the form like this one.

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/b/8/b81952d3c0c9874a26762bbec80d01ecaa8a1e5f.png)

Thank you

---

<div class="post-metadata">

**Author:** ![michaelderekjones](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/michaelderekjones/32/14819_2.png) [@michaelderekjones](https://community.postman.com/u/michaelderekjones)\
**Post date:** [September 21, 2023, 4:53pm UTC](https://community.postman.com/t/why-am-i-not-able-to-see-the-values-that-was-posted-in-form/52114/4 "2023-09-21T16:53:24Z")

</div>

Your API is outputting\returning HTML.

Therefore Postman is going to display that HTML including the tags, where your browser will show the formatted HTML.

If you want to pull the values properly from the response, then return it as JSON instead of HTML then have your front end consume the response and deal with the formatting.

---

<div class="post-metadata">

**Author:** ![lunar-module-sagani1](https://avatars.discourse-cdn.com/v4/letter/l/c0e974/32.png) [@lunar-module-sagani1](https://community.postman.com/u/lunar-module-sagani1)\
**Post date:** [September 21, 2023, 9:48pm UTC](https://community.postman.com/t/why-am-i-not-able-to-see-the-values-that-was-posted-in-form/52114/5 "2023-09-21T21:48:26Z")

</div>

Am I doing something wrong in my python code or in the postman?

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/e/c/eca1779b48f61941accc5aac43c6b72e0b9e62e7.png)  
 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/0/5/05407bfb91ef599422d762b5cf4b409e7f1659a1.png)

---

<div class="post-metadata">

**Author:** ![amit](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/amit/32/2056_2.png) [@amit](https://community.postman.com/u/amit)\
**Post date:** [September 22, 2023, 1:48am UTC](https://community.postman.com/t/why-am-i-not-able-to-see-the-values-that-was-posted-in-form/52114/6 "2023-09-22T01:48:21Z")

</div>

@lunar-module-sagani1 Base on the latest screenshots you shared, you are still passing data as JSON via Postman and reading it as form data.

_If that is what you want, check Flask docs to learn on how to read JSON data:_

- [https://flask.palletsprojects.com/en/2.3.x/api/#flask.Request](https://flask.palletsprojects.com/en/2.3.x/api/#flask.Request)
- [https://flask.palletsprojects.com/en/2.3.x/api/#flask.Request.json](https://flask.palletsprojects.com/en/2.3.x/api/#flask.Request.json)
- [python - Get the data received in a Flask request - Stack Overflow](https://stackoverflow.com/a/16664376)

_For consuming the response_

- If you just want to “view” your data in Postman you can switch to “[Preview](https://stackoverflow.com/a/16664376)” tab in the response pane to render the HTML the way a browser does.
- If you want to read the returned data, JSON response would be better as suggested by @michaelderekjones. Also checkout [Postman’s documentation on scripting](https://learning.postman.com/docs/writing-scripts/intro-to-scripts/).

---

<div class="post-metadata">

**Author:** ![lunar-module-sagani1](https://avatars.discourse-cdn.com/v4/letter/l/c0e974/32.png) [@lunar-module-sagani1](https://community.postman.com/u/lunar-module-sagani1)\
**Post date:** [September 22, 2023, 3:39am UTC](https://community.postman.com/t/why-am-i-not-able-to-see-the-values-that-was-posted-in-form/52114/7 "2023-09-22T03:39:19Z")

</div>

I add a route to my code so now when they submit the form it will do a get method and hold under “/get\_session\_data”. But now in the postman what should I do to get that get values to display on the bottom and not get null as value.

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/f/9/f97b6fd0615790f41080b93e1b8af84d5bc9c729.png)  
 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/6/7/67efbc4d125fb15d311057f1fa98ef0c86a72a36.png)  
 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/a/b/ab6d3bbc1c7483e44b9d4770ce270ed4de92d1d3.png)

---

<div class="post-metadata">

**Author:** ![michaelderekjones](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/michaelderekjones/32/14819_2.png) [@michaelderekjones](https://community.postman.com/u/michaelderekjones)\
**Post date:** [September 22, 2023, 9:04am UTC](https://community.postman.com/t/why-am-i-not-able-to-see-the-values-that-was-posted-in-form/52114/8 "2023-09-22T09:04:33Z")

</div>

The response showing as null is down to your code\API, not Postman.

I’m not a developer so I can’t help with Python\Flask code, but the same principle applies to Python for troubleshooting, which would be to console log (or the Python equivalent) your variables before you consume them.

Console log the response\_data JSON variable in your Python code. Is it showing the values as you expect?

However, on face value, it still looks like you are trying to read the values as form data, when they are JSON, therefore I suspect those variables will be undefined or null.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/system/32/29796_2.png) [@system](https://community.postman.com/u/system)\
**Post date:** [October 22, 2023, 9:05am UTC](https://community.postman.com/t/why-am-i-not-able-to-see-the-values-that-was-posted-in-form/52114/9 "2023-10-22T09:05:29Z")

</div>

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