Python Forum
Flask rest api How to retrieve json request
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Flask rest api How to retrieve json request
#1
Hello,
I am new to Python. I have a flask rest api. I am trying to call another rest api inside of my method. I would like to know if there is a way to get json request data when my method is called?

Here is my code portion:
# POST /purchase_initiation
@app.route('/purchase_initiation', methods=['POST'])
def initiation():
    try:
        # if request.is_json:
            # getting request data
            request_data = request.json()
            print request_data
On the Print I am getting 'NoneType' object is not callable error. By the way I am sending POST request from POSTMAN.

Thanks in advance.
Best Regards.
Reply


Messages In This Thread
Flask rest api How to retrieve json request - by raysefo - Nov-26-2018, 10:45 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  API Request / JSON illmattic 3 1,094 Aug-01-2023, 10:14 AM
Last Post: Gaurav_Kumar
  REST API using flask - limit connection? korenron 1 1,392 Feb-05-2023, 06:48 PM
Last Post: noisefloor
  Flask Rest API - fire and forget MorganSamage 2 1,691 Feb-04-2023, 11:09 AM
Last Post: MorganSamage
  Flask TypeError: Object of type Decimal is not JSON serializable mekacharan 0 4,042 Jul-15-2021, 05:28 AM
Last Post: mekacharan
  Flask Basics request.form ifigazsi 0 1,858 Feb-09-2021, 09:05 AM
Last Post: ifigazsi
  Flask request.form ifigazsi 2 3,944 Feb-02-2021, 11:56 AM
Last Post: buran
  Retrieve images base64 encoded MongoDB and Flask Nuwan16 2 3,397 Oct-13-2020, 06:25 PM
Last Post: Nuwan16
  Return Frame as well as JSON response using same API in Flask Python Ask jenkins43 0 1,945 May-11-2020, 04:58 PM
Last Post: jenkins43
  Simple flask rest api problem cancerboi 4 2,914 Jan-29-2020, 03:10 PM
Last Post: brighteningeyes
  Flask redirect(request.url) returns None iFunKtion 1 10,599 Nov-27-2018, 10:50 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020