bookshop web service the url and thus to the function insteadwithin the function it is necessary to obtain the request object and then to use that to obtain the information held within the body of the request key attribute on the request objectavailable when http request contains json datais the request json attribute this attribute contains dictionary like structure holding the values associated with the keys in the json data structure this is shown below for the create_book(function from flask import requestabort @app route('/book'methods=['post']def create_book()print('create book'if not request json or not 'isbnin request jsonabort( book book(request json['isbn']request json['title']request json get('author'"")float(request json['price'])bookshop add_book(bookreturn jsonify({'book'book}) the above function accesses the flask request object that represents the current http request the function first checks to see that it contains json data and that the isbn of the book to addis part of that json structure if it the isbn is not then the flask abort(function is called passing in suitable http response status code in this case the error code indicates that this was bad request (http error code if however the json data is present and does contain an isbn number then the values for the keys isbntitleauthor and price are obtained remember that json is dictionary like structure of keys and values thus treating it in this way makes it easy to extract the data that json structure holds it also means that we can use both method and key oriented access styles this is shown above where we use the get(method along with default value to useif an author is not specified finallyas we want to treat the price as floating point number we must use the float(function to convert the string format supplied by json into float using the data extracted we can instantiate new book instance that can be added to the bookshop as is common in web services we are returning the newly created book object as the result of creating the book along with the http response status code which indicates the successful creation of resource