Base URL

Each API pattern can be different, but should generally include a base URL that indicates the API version and should link to the other endpoints available within the API. This application will use a base URL pattern of nba/api/v0.1. In this case, the home URL ('/') will redirect to the base URL of the API:

@app.route('/', methods=['GET'])
def get_api():
return redirect('/nba/api/v0.1')

@app.route('/nba/api/v0.1', methods=['GET'])
def get_endpoints():
data= [{'name':"Arena", "endpoint":"/arena"},
{'name':"State", "endpoint":"/state"},
{'name':"County", "endpoint":"/county"},
{'name':"District", "endpoint":"/district"},]
return jsonify({"endpoints":data})

The endpoints for each of the following sections are available from the base URL. Each resource URL can be constructed by adding the resource-specific endpoint to the base URL.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset