April 2018
Beginner to intermediate
440 pages
11h 36m
English
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. ...