{"info":{"_postman_id":"06d6ddc1-bdaa-4e56-9fd1-f96d877b190a","name":"Planetary API","description":"<html><head></head><body><p>This collection contains the Planetary API that has been built in <strong>RestfulAPIs</strong> with <strong>Python 3</strong> and <strong>Flask</strong> in <strong>PyCharm</strong>.</p>\n<p>HTTP methods:</p>\n<ul>\n<li>GET</li>\n<li>POST</li>\n<li>PUT</li>\n<li>DELETE</li>\n</ul>\n<p><em>*The application and</em> <em><strong>SQLite</strong></em> <em>database</em> <em>are used only for testing. As of now, they are not allowed to push into production.</em></p>\n<h4 id=\"endpoints\"><strong>Endpoints</strong></h4>\n<p>GET/super_simple<br>GET/not_found<br>GET/parameters<br>GET/url_variables<br>GET/planets<br>GET/retrieve_password<br>GET/planet_details<br>POST/register<br>POST/login<br>POST/add_planet<br>PUT/update_planet<br>DELETE/remove_planet</p>\n<h4 id=\"database-models\">Database Models</h4>\n<h6 id=\"user---planetarys-users\"><em>User -</em> planetary's users</h6>\n<h6 id=\"planet---planets-details\"><em>Planet -</em> planet's details</h6>\n</body></html>","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","toc":[],"owner":"24066287","collectionId":"06d6ddc1-bdaa-4e56-9fd1-f96d877b190a","publishedId":"2s8YYEMPRX","public":true,"customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"EF5B25"},"publishDate":"2022-11-04T20:20:07.000Z"},"item":[{"name":"http://localhost:5000/super_simple","id":"0c43bde2-4afc-4e4f-b4e2-1a4efc743fcd","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"http://localhost:5000/super_simple","description":"<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-python\">@app.route('/super_simple')\ndef super_simple():\n    return jsonify(message='Hello from the Planetary API.'), 200\n\n</code></pre>\n<h5 id=\"success-code\">Success code</h5>\n<p>200 OK - The expected response received.</p>\n","urlObject":{"protocol":"http","port":"5000","path":["super_simple"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"0c43bde2-4afc-4e4f-b4e2-1a4efc743fcd"},{"name":"http://localhost:5000/not_found","id":"2a5b23e7-5b7c-458b-8f62-95c73b2c24e2","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"http://localhost:5000/not_found","description":"<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-python\">@app.route('/not_found')\ndef not_found():\n    return jsonify(message='That resource was not found.'), 404\n\n</code></pre>\n<h5 id=\"error-code\">Error code</h5>\n<p>404 - Not found.</p>\n","urlObject":{"protocol":"http","port":"5000","path":["not_found"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"2a5b23e7-5b7c-458b-8f62-95c73b2c24e2"},{"name":"http://localhost:5000/parameters?name=Patrik&age=26","id":"74de4e4d-9739-4e96-93db-b88ff0f0fe60","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"http://localhost:5000/parameters?name=Patrik&age=26","description":"<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-python\">@app.route('/parameters')\ndef parameters():\n    name = request.args.get('name')\n    age = int(request.args.get('age'))\n    if age &lt; 18:\n        return jsonify(message='Sorry ' + name + ', you are not old enough.'), 401\n    else:\n        return jsonify(message='Welcome ' + name + ', you are old enough.')\n</code></pre>\n<h5 id=\"error-code\">Error code</h5>\n<p>401 - Unauthorized.</p>\n","urlObject":{"protocol":"http","port":"5000","path":["parameters"],"host":["localhost"],"query":[{"key":"name","value":"Patrik"},{"key":"age","value":"26"}],"variable":[]}},"response":[],"_postman_id":"74de4e4d-9739-4e96-93db-b88ff0f0fe60"},{"name":"http://localhost:5000/url_variables/Patrik/26","id":"119d64b5-173f-44d5-a300-8765c93df7a9","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"http://localhost:5000/url_variables/Patrik/26","description":"<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-python\">@app.route('/url_variables//')\ndef url_variables(name: str, age: int):\n    if age &lt; 18:\n        return jsonify(message='Sorry ' + name + ', you are not old enough.'), 401\n    else:\n        return jsonify(message='Welcome ' + name + ', you are old enough.')\n</code></pre>\n","urlObject":{"protocol":"http","port":"5000","path":["url_variables","Patrik","26"],"host":["localhost"],"query":[{"disabled":true,"key":"","value":""}],"variable":[]}},"response":[],"_postman_id":"119d64b5-173f-44d5-a300-8765c93df7a9"},{"name":"http://localhost:5000/url_variables/Patrik/14","id":"6c0b13ca-e18f-4296-872e-2a9d361b9d40","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"http://localhost:5000/url_variables/Patrik/14","description":"<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-python\">@app.route('/url_variables//')\ndef url_variables(name: str, age: int):\n    if age &lt; 18:\n        return jsonify(message='Sorry ' + name + ', you are not old enough.'), 401\n    else:\n        return jsonify(message='Welcome ' + name + ', you are old enough.')\n\n</code></pre>\n<h5 id=\"error-code\">Error code</h5>\n<p>401 - Unauthorized.</p>\n","urlObject":{"protocol":"http","port":"5000","path":["url_variables","Patrik","14"],"host":["localhost"],"query":[{"disabled":true,"key":"","value":""}],"variable":[]}},"response":[],"_postman_id":"6c0b13ca-e18f-4296-872e-2a9d361b9d40"},{"name":"http://localhost:5000/planets","id":"80114079-2da9-4c08-b997-2dfe9ae776ce","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"http://localhost:5000/planets","description":"<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-python\">@app.route('/planets', methods=['GET'])\ndef planets():\n    planets_list = Planet.query.all()\n    result = planets_schema.dump(planets_list)\n    return jsonify(result)\n\n</code></pre>\n<h5 id=\"http-method\">HTTP method:</h5>\n<p>GET request</p>\n","urlObject":{"protocol":"http","port":"5000","path":["planets"],"host":["localhost"],"query":[{"disabled":true,"key":"","value":""}],"variable":[]}},"response":[],"_postman_id":"80114079-2da9-4c08-b997-2dfe9ae776ce"},{"name":"http://localhost:5000/register","id":"bfb52d0b-b943-464f-a874-a9900d268440","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"formdata","formdata":[{"key":"email","value":"food@bar.com","type":"text"},{"key":"first_name","value":"Galileo","type":"text"},{"key":"last_name","value":"Gallei","type":"text"},{"key":"password","value":"test","type":"text"}]},"url":"http://localhost:5000/register","description":"<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-python\">@app.route('/register', methods=['POST'])\ndef register():\n    email = request.form['email']\n    test = User.query.filter_by(email=email).first()\n    if test:\n        return jsonify(message='That email already exists.'), 409\n    else:\n        first_name = request.form['first_name']\n        last_name = request.form['last_name']\n        password = request.form['password']\n        user = User(first_name=first_name, last_name=last_name, email=email, password=password)\n        db.session.add(user)\n        db.session.commit()\n        return jsonify(message='User created successfully.'), 201\n\n</code></pre>\n<h5 id=\"http-method\">HTTP method</h5>\n<p>POST request</p>\n<h5 id=\"success-code\">Success code</h5>\n<p>201 - Created</p>\n","urlObject":{"protocol":"http","port":"5000","path":["register"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"bfb52d0b-b943-464f-a874-a9900d268440"},{"name":"http://localhost:5000/register","id":"df75e8b7-0a37-4bf4-8bd0-a88466ac271f","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"formdata","formdata":[{"key":"email","value":"test@test.com","type":"text"},{"key":"first_name","value":"Galileo","type":"text"},{"key":"last_name","value":"Gallei","type":"text"},{"key":"password","value":"test","type":"text"}]},"url":"http://localhost:5000/register","description":"<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-python\">@app.route('/register', methods=['POST'])\ndef register():\n    email = request.form['email']\n    test = User.query.filter_by(email=email).first()\n    if test:\n        return jsonify(message='That email already exists.'), 409\n    else:\n        first_name = request.form['first_name']\n        last_name = request.form['last_name']\n        password = request.form['password']\n        user = User(first_name=first_name, last_name=last_name, email=email, password=password)\n        db.session.add(user)\n        db.session.commit()\n        return jsonify(message='User created successfully.'), 201\n</code></pre>\n<h5 id=\"http-method\">HTTP method</h5>\n<p>POST request</p>\n<h5 id=\"error-code\">Error code</h5>\n<p>409 - Conflict</p>\n","urlObject":{"protocol":"http","port":"5000","path":["register"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"df75e8b7-0a37-4bf4-8bd0-a88466ac271f"},{"name":"http://localhost:5000/login","id":"b08b13d4-c975-4bd1-992b-0ac0b567ede8","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"formdata","formdata":[{"key":"email","value":"test@test.com","type":"text"},{"key":"password","value":"p@ssw@rd","type":"text"}]},"url":"http://localhost:5000/login","description":"<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-python\">@app.route('/login', methods=['POST'])\ndef login():\n    if request.is_json:\n        email = request.json['email']\n        password = request.json['password']\n    else:\n        email = request.form['email']\n        password = request.form['password']\n    test = User.query.filter_by(email=email, password=password).first()\n    if test:\n        access_token = create_access_token(identity=email)\n        return jsonify(message='Login succeeded.', access_token=access_token)\n    else:\n        return jsonify(message='Bad email or password.'), 401\n\n</code></pre>\n<h5 id=\"http-method\">HTTP method</h5>\n<p>POST request</p>\n<p><em>*This POST method is also used for generating</em> <em><strong>Authentication Token.</strong></em></p>\n","urlObject":{"protocol":"http","port":"5000","path":["login"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"b08b13d4-c975-4bd1-992b-0ac0b567ede8"},{"name":"http://localhost:5000/retrieve_password/test@test.com","id":"4cb24a09-e16e-446f-8178-7e85f869b972","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"http://localhost:5000/retrieve_password/test@test.com","description":"<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-python\">@app.route('/retrieve_password/', methods=['GET'])\ndef retrieve_password(email: str):\n    user = User.query.filter_by(email=email).first()\n    if user:\n        msg = Message(\"Your planetary API password is \" + user.password,\n                      sender=\"admin@planetary-api.com\",\n                      recipients=[email])\n        mail.send(msg)\n        return jsonify(message='Password send to ' + email)\n    else:\n        return jsonify(message='That email doesn\\'t exist.'), 401\n\n</code></pre>\n<h5 id=\"http-method\">HTTP method</h5>\n<p>GET request</p>\n<p>*<em>Email testing, automate test flows to retrieve password with</em> <em><strong>Mailtrap.io.</strong></em></p>\n","urlObject":{"protocol":"http","port":"5000","path":["retrieve_password","test@test.com"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"4cb24a09-e16e-446f-8178-7e85f869b972"},{"name":"http://localhost:5000/planet_details/1","id":"92bce598-d83b-40ad-a193-ebf5d51694aa","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"http://localhost:5000/planet_details/1","description":"<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-python\">@app.route('/planet_details/', methods=['GET'])\ndef planet_details(planet_id: int):\n    planet = Planet.query.filter_by(planet_id=planet_id).first()\n    if planet:\n        result = planet_schema.dump(planet)\n        return jsonify(result)\n    else:\n        return jsonify(message='That planet does not exist.'), 404\n</code></pre>\n<h5 id=\"http-method\">HTTP method</h5>\n<p>GET request</p>\n","urlObject":{"protocol":"http","port":"5000","path":["planet_details","1"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"92bce598-d83b-40ad-a193-ebf5d51694aa"},{"name":"http://localhost:5000/planet_details/4","id":"cd7ab01b-04f4-442a-b620-17d89a57c527","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"http://localhost:5000/planet_details/4","description":"<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-python\">@app.route('/planet_details/', methods=['GET'])\ndef planet_details(planet_id: int):\n    planet = Planet.query.filter_by(planet_id=planet_id).first()\n    if planet:\n        result = planet_schema.dump(planet)\n        return jsonify(result)\n    else:\n        return jsonify(message='That planet does not exist.'), 404\n</code></pre>\n<h5 id=\"http-method\">HTTP method</h5>\n<p>GET request</p>\n<h5 id=\"error-code\">Error code</h5>\n<p>404 - Not found.</p>\n","urlObject":{"protocol":"http","port":"5000","path":["planet_details","4"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"cd7ab01b-04f4-442a-b620-17d89a57c527"},{"name":"http://localhost:5000/add_planet","id":"e093322d-7437-4a26-ac29-ece96f2976af","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"<token>"}]},"isInherited":false},"method":"POST","header":[],"body":{"mode":"formdata","formdata":[{"key":"planet_name","value":"Pluto","type":"text"},{"key":"planet_type","value":"Class K","type":"text"},{"key":"home_star","value":"Sol","type":"text"},{"key":"mass","value":"1024E26","type":"text"},{"key":"radius","value":"24622","type":"text"},{"key":"distance","value":"434245678","type":"text"}]},"url":"http://localhost:5000/add_planet","description":"<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-python\">@app.route('/add_planet', methods=['POST'])\n@jwt_required()\ndef add_planet():\n    planet_name = request.form['planet_name']\n    test = Planet.query.filter_by(planet_name=planet_name).first()\n    if test:\n        return jsonify('There is already a planet by that name.'), 409\n    else:\n        planet_type = request.form['planet_type']\n        home_star = request.form['home_star']\n        mass = float(request.form['mass'])\n        radius = float(request.form['radius'])\n        distance = float(request.form['distance'])\n        new_planet = Planet(planet_name=planet_name,\n                            planet_type=planet_type,\n                            home_star=home_star,\n                            mass=mass,\n                            radius=radius,\n                            distance=distance)\n        db.session.add(new_planet)\n        db.session.commit()\n        return jsonify(messgae='You added a planet!'), 201\n\n</code></pre>\n<h5 id=\"http-method\">HTTP method</h5>\n<p>POST request</p>\n<h5 id=\"success-code\">Success code</h5>\n<p>201 - Created.</p>\n<p>*<em><strong>Authorization bearer token</strong></em> <em>used for generating token authorization that is a very long and unique token.</em></p>\n","urlObject":{"protocol":"http","port":"5000","path":["add_planet"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"e093322d-7437-4a26-ac29-ece96f2976af"},{"name":"http://localhost:5000/add_planet","id":"3f48a760-a0bc-4395-888c-1da4a946a71e","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"<token>"}]},"isInherited":false},"method":"POST","header":[],"body":{"mode":"formdata","formdata":[{"key":"planet_name","value":"Pluto","type":"text"},{"key":"planet_type","value":"Class K","type":"text"},{"key":"home_star","value":"Sol","type":"text"},{"key":"mass","value":"1024E26","type":"text"},{"key":"radius","value":"24622","type":"text"},{"key":"distance","value":"434245678","type":"text"}]},"url":"http://localhost:5000/add_planet","description":"<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-python\">@app.route('/add_planet', methods=['POST'])\n@jwt_required()\ndef add_planet():\n    planet_name = request.form['planet_name']\n    test = Planet.query.filter_by(planet_name=planet_name).first()\n    if test:\n        return jsonify('There is already a planet by that name.'), 409\n    else:\n        planet_type = request.form['planet_type']\n        home_star = request.form['home_star']\n        mass = float(request.form['mass'])\n        radius = float(request.form['radius'])\n        distance = float(request.form['distance'])\n        new_planet = Planet(planet_name=planet_name,\n                            planet_type=planet_type,\n                            home_star=home_star,\n                            mass=mass,\n                            radius=radius,\n                            distance=distance)\n        db.session.add(new_planet)\n        db.session.commit()\n        return jsonify(messgae='You added a planet!'), 201\n\n</code></pre>\n<h5 id=\"http-method\">HTTP method</h5>\n<p>POST request</p>\n<h5 id=\"error-code\">Error code</h5>\n<p>409 - Conflict.</p>\n<p>*<em><strong>Authorization bearer token</strong></em> <em>used for generating token authorization that is a very long and unique token.</em></p>\n","urlObject":{"protocol":"http","port":"5000","path":["add_planet"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"3f48a760-a0bc-4395-888c-1da4a946a71e"},{"name":"http://localhost:5000/update_planet","id":"36119224-9974-4d6e-9ad5-26a7aa7de7d7","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PUT","header":[],"body":{"mode":"formdata","formdata":[{"key":"planet_id","value":"1","type":"text"},{"key":"planet_name","value":"Mercury","type":"text"},{"key":"planet_type","value":"Class Z","type":"text"},{"key":"home_star","value":"Alpha Centauri","type":"text"},{"key":"mass","value":"1234567e3","type":"text"},{"key":"radius","value":"1234567e3","type":"text"},{"key":"distance","value":"1234567e3","type":"text"}]},"url":"http://localhost:5000/update_planet","description":"<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-python\">@app.route('/update_planet', methods=['PUT'])\n@jwt_required()\ndef update_planet():\n    planet_id = int(request.form['planet_id'])\n    planet = Planet.query.filter_by(planet_id=planet_id).first()\n    if planet:\n        planet.planet_name = request.form['planet_name']\n        planet.planet_type = request.form['planet_type']\n        planet.home_star = request.form['home_star']\n        planet.mass = float(request.form['mass'])\n        planet.radius = float(request.form['radius'])\n        planet.distance = float(request.form['distance'])\n        db.session.commit()\n        return jsonify(messae='You updated a planet.'), 202\n    else:\n        return jsonify(message='That planet does not exist.'), 404\n\n</code></pre>\n<h5 id=\"http-method\">HTTP method</h5>\n<p>PUT request</p>\n<h5 id=\"success-code\">Success code</h5>\n<p>202 - Accepted.</p>\n<p>*<em><strong>Authorization bearer token</strong></em> <em>used for generating token authorization that is a very long and unique token.</em></p>\n","urlObject":{"protocol":"http","port":"5000","path":["update_planet"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"36119224-9974-4d6e-9ad5-26a7aa7de7d7"},{"name":"http://localhost:5000/update_planet","id":"bbfd1c4a-71c2-4ad6-b16b-d0c20beb31cc","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PUT","header":[],"body":{"mode":"formdata","formdata":[{"key":"planet_id","value":"1","type":"text"},{"key":"planet_name","value":"Mercury","type":"text"},{"key":"planet_type","value":"Class Z","type":"text"},{"key":"home_star","value":"Alpha Centauri","type":"text"},{"key":"mass","value":"1234567e3","type":"text"},{"key":"radius","value":"1234567e3","type":"text"},{"key":"distance","value":"1234567e3","type":"text"}]},"url":"http://localhost:5000/update_planet","description":"<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-python\">@app.route('/update_planet', methods=['PUT'])\n@jwt_required()\ndef update_planet():\n    planet_id = int(request.form['planet_id'])\n    planet = Planet.query.filter_by(planet_id=planet_id).first()\n    if planet:\n        planet.planet_name = request.form['planet_name']\n        planet.planet_type = request.form['planet_type']\n        planet.home_star = request.form['home_star']\n        planet.mass = float(request.form['mass'])\n        planet.radius = float(request.form['radius'])\n        planet.distance = float(request.form['distance'])\n        db.session.commit()\n        return jsonify(messae='You updated a planet.'), 202\n    else:\n        return jsonify(message='That planet does not exist.'), 404\n\n</code></pre>\n<h5 id=\"http-method\">HTTP method</h5>\n<p>PUT request</p>\n<h5 id=\"error-code\">Error code</h5>\n<p>404 - Not found.</p>\n<p>*<em><strong>Authorization bearer token</strong></em> <em>used for generating token authorization that is a very long and unique token.</em></p>\n","urlObject":{"protocol":"http","port":"5000","path":["update_planet"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"bbfd1c4a-71c2-4ad6-b16b-d0c20beb31cc"},{"name":"http://localhost:5000/remove_planet/1","id":"85af6305-451f-4237-8f97-bedf18e0e49e","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"<token>"}]},"isInherited":false},"method":"DELETE","header":[],"body":{"mode":"formdata","formdata":[]},"url":"http://localhost:5000/remove_planet/1","description":"<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-python\">@app.route('/remove_planet/', methods=['DELETE'])\n@jwt_required()\ndef remove_planet(planet_id: int):\n    planet = Planet.query.filter_by(planet_id=planet_id).first()\n    if planet:\n        db.session.delete(planet)\n        db.session.commit()\n        return jsonify(message='You deleted a planet.'), 202\n    else:\n        return jsonify(message='That planet does not exist.'), 404\n\n</code></pre>\n<h5 id=\"http-method\">HTTP method</h5>\n<p>DELETE request</p>\n<h5 id=\"success-code\">Success code</h5>\n<p>202 - Accepted.</p>\n<p>*<em><strong>Authorization bearer token</strong></em> <em>used for generating token authorization that is a very long and unique token.</em></p>\n","urlObject":{"protocol":"http","port":"5000","path":["remove_planet","1"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"85af6305-451f-4237-8f97-bedf18e0e49e"},{"name":"http://localhost:5000/remove_planet/100","id":"9f88d75a-1c8b-4f00-a964-fee4899d591f","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"<token>"}]},"isInherited":false},"method":"DELETE","header":[],"body":{"mode":"formdata","formdata":[]},"url":"http://localhost:5000/remove_planet/100","description":"<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-python\">@app.route('/remove_planet/', methods=['DELETE'])\n@jwt_required()\ndef remove_planet(planet_id: int):\n    planet = Planet.query.filter_by(planet_id=planet_id).first()\n    if planet:\n        db.session.delete(planet)\n        db.session.commit()\n        return jsonify(message='You deleted a planet.'), 202\n    else:\n        return jsonify(message='That planet does not exist.'), 404\n\n</code></pre>\n<h5 id=\"http-method\">HTTP method</h5>\n<p>DELETE request</p>\n<h5 id=\"error-code\">Error code</h5>\n<p>404 - Not found.</p>\n<p>*<em><strong>Authorization bearer token</strong></em> <em>used for generating token authorization that is a very long and unique token.</em></p>\n","urlObject":{"protocol":"http","port":"5000","path":["remove_planet","100"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"9f88d75a-1c8b-4f00-a964-fee4899d591f"}]}