diff --git a/.gitignore b/.gitignore index 8e1bef19..b90e6c56 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ staticfiles .env db.sqlite3 .DS_Store +.idea diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 556ea8e9..301c8c38 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,34 +1,49 @@ ## Contributing -Make sure your contribution isn't already a planned feature or has already been fixed by checking the issues first. +Make sure your contribution isn't already a planned feature or has already +been fixed by checking the issues first. 1. Fork this project. -2. Find an issue to fix or create a new issue if you want to propose a feature. Generally speaking, everyone wants features. I'm only going to merge features that have 2 or more +1, otherwise this project will fill up with lots of random stuff. +2. Find an issue to fix or create a new issue if you want to propose a feature. For + the new features - check out on GitHub issues first before starting to code it. + +3. **No changes in the current API** are accepted. Even backward-compatible ones. + The only exception is extending database and fixing data issues. These are OK. For + all other changes - please submit a request and we'll review the feature for v2 of API. + Current version will remain the same for the sake of compatibility with all the + example code that API enthusiasts created. -3. Write your codez, make sure you add tests. Check out the "development" section below. +## Development -4. Submit a descriptive pull request that is *up to date with the master branch*. +An application was originally built with Python 2.7 and Django 1.x. This stack is outdated hence +continuing with this code base is not adviced. The next version of SWAPI will likely be +cloud native and serverless. -5. We'll accept it and add it to production! +If you insist, best use Docker for building and running the project (Dockerfile is included +in the root folder) +```shell +docker build -t myswapi . +docker run -p 8000:8000 myswapi +``` -## Development +The same image is available as `juriy/swapi` from DockerHub. -Once you have downloaded the project, look at the Makefile to see a list of useful shortcut commands. +# Django commands -In order to get started run: +The commands below are already executed in Docker image, if you need to work with Django +directly or from inside the docker image, the following commands may be useful -``` -make install -make build -make load_data -``` +```shell +# run DB migrations +python manage.py migrate -To run the server locally run: +# load data from fixtures +make load_data -``` -make serve +# run the server +python manage.py runserver 0.0.0.0:8000 ``` If you add new data then you can dump it out using the following command: @@ -43,15 +58,10 @@ To run tests: make test ``` -*NOTE:* pull requests will not be accepted if they do not pass tests or have no new tests for new features. - - ## File structure -- resources - +### /resources All API resource models, serializers and schemas are found here. -- swapi - +### /swapi All Django configuration, templates and static files are found here. diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..b41f9f54 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +# syntax=docker/dockerfile:1 +FROM python:2 +ENV PYTHONUNBUFFERED=1 +RUN apt-get update && apt-get install -y libmemcached-dev +WORKDIR /code +COPY . /code/ +RUN pip install -r requirements.txt +CMD ["sh", "-c", "./run.sh"] diff --git a/README.md b/README.md index 6fd690aa..e5cec846 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,16 @@ # SWAPI -## The Star Wars API +## The Star Wars API -## NO LONGER MAINTAINED! +Source code for [swapi.dev](https://swapi.dev) -If you rely on this project for your own tools - then please fork and spin up your own instance. It's a pretty simple project, and the Makefile will take you a long way. -If you are looking for an API to play with to learn about APIs, then I recommend [https://pokeapi.co](https://pokeapi.co). +## What happened to swapi.co? +Unfortunately swapi.co is not maintained anymore. + +## What is swapi.dev? +An "unofficial" branch of "swapi", supported by @juriy + + +## Will it be updated? +Original swapi project is built on Python/Django stack that is quite outdated by now. It would be a great exercise to rewrite it in cloud-native manner, but this requires time and effort. I'm looking into doing that. There's no timelines yet, since "swapi" stopped its existence quite suddenly. Suggestions and help are always welcome! + diff --git a/requirements.txt b/requirements.txt index c389e7bd..8d690102 100644 --- a/requirements.txt +++ b/requirements.txt @@ -16,9 +16,9 @@ django-pylibmc==0.5.0 djangorestframework==3.0.0 drf-json-api==0.1.0 gunicorn==19.1.1 -keen==0.3.7 +keen==0.3.0 markdown2==2.3.0 -psycopg2==2.5.4 +psycopg2==2.7.3.2 pycrypto==2.6.1 pylibmc==1.4.1 requests==2.5.1 diff --git a/resources/fixtures/films.json b/resources/fixtures/films.json index 60cb7188..4215f231 100644 --- a/resources/fixtures/films.json +++ b/resources/fixtures/films.json @@ -28,7 +28,7 @@ "created": "2014-12-10T14:23:31.880Z", "episode_id": 4, "director": "George Lucas", - "release_date": "1977-05-25", + "release_date": "1977-05-25", "opening_crawl": "It is a period of civil war.\r\nRebel spaceships, striking\r\nfrom a hidden base, have won\r\ntheir first victory against\r\nthe evil Galactic Empire.\r\n\r\nDuring the battle, Rebel\r\nspies managed to steal secret\r\nplans to the Empire's\r\nultimate weapon, the DEATH\r\nSTAR, an armored space\r\nstation with enough power\r\nto destroy an entire planet.\r\n\r\nPursued by the Empire's\r\nsinister agents, Princess\r\nLeia races home aboard her\r\nstarship, custodian of the\r\nstolen plans that can save her\r\npeople and restore\r\nfreedom to the galaxy....", "characters": [ 1, @@ -94,7 +94,7 @@ "created": "2014-12-12T11:26:24.656Z", "episode_id": 5, "director": "Irvin Kershner", - "release_date": "1980-05-17", + "release_date": "1980-05-17", "opening_crawl": "It is a dark time for the\r\nRebellion. Although the Death\r\nStar has been destroyed,\r\nImperial troops have driven the\r\nRebel forces from their hidden\r\nbase and pursued them across\r\nthe galaxy.\r\n\r\nEvading the dreaded Imperial\r\nStarfleet, a group of freedom\r\nfighters led by Luke Skywalker\r\nhas established a new secret\r\nbase on the remote ice world\r\nof Hoth.\r\n\r\nThe evil lord Darth Vader,\r\nobsessed with finding young\r\nSkywalker, has dispatched\r\nthousands of remote probes into\r\nthe far reaches of space....", "characters": [ 1, @@ -164,7 +164,7 @@ "created": "2014-12-18T10:39:33.255Z", "episode_id": 6, "director": "Richard Marquand", - "release_date": "1983-05-25", + "release_date": "1983-05-25", "opening_crawl": "Luke Skywalker has returned to\r\nhis home planet of Tatooine in\r\nan attempt to rescue his\r\nfriend Han Solo from the\r\nclutches of the vile gangster\r\nJabba the Hutt.\r\n\r\nLittle does Luke know that the\r\nGALACTIC EMPIRE has secretly\r\nbegun construction on a new\r\narmored space station even\r\nmore powerful than the first\r\ndreaded Death Star.\r\n\r\nWhen completed, this ultimate\r\nweapon will spell certain doom\r\nfor the small band of rebels\r\nstruggling to restore freedom\r\nto the galaxy...", "characters": [ 1, @@ -232,7 +232,7 @@ "created": "2014-12-19T16:52:55.740Z", "episode_id": 1, "director": "George Lucas", - "release_date": "1999-05-19", + "release_date": "1999-05-19", "opening_crawl": "Turmoil has engulfed the\r\nGalactic Republic. The taxation\r\nof trade routes to outlying star\r\nsystems is in dispute.\r\n\r\nHoping to resolve the matter\r\nwith a blockade of deadly\r\nbattleships, the greedy Trade\r\nFederation has stopped all\r\nshipping to the small planet\r\nof Naboo.\r\n\r\nWhile the Congress of the\r\nRepublic endlessly debates\r\nthis alarming chain of events,\r\nthe Supreme Chancellor has\r\nsecretly dispatched two Jedi\r\nKnights, the guardians of\r\npeace and justice in the\r\ngalaxy, to settle the conflict....", "characters": [ 2, @@ -335,7 +335,7 @@ "created": "2014-12-20T10:57:57.886Z", "episode_id": 2, "director": "George Lucas", - "release_date": "2002-05-16", + "release_date": "2002-05-16", "opening_crawl": "There is unrest in the Galactic\r\nSenate. Several thousand solar\r\nsystems have declared their\r\nintentions to leave the Republic.\r\n\r\nThis separatist movement,\r\nunder the leadership of the\r\nmysterious Count Dooku, has\r\nmade it difficult for the limited\r\nnumber of Jedi Knights to maintain \r\npeace and order in the galaxy.\r\n\r\nSenator Amidala, the former\r\nQueen of Naboo, is returning\r\nto the Galactic Senate to vote\r\non the critical issue of creating\r\nan ARMY OF THE REPUBLIC\r\nto assist the overwhelmed\r\nJedi....", "characters": [ 2, @@ -451,7 +451,7 @@ "created": "2014-12-20T18:49:38.403Z", "episode_id": 3, "director": "George Lucas", - "release_date": "2005-05-19", + "release_date": "2005-05-19", "opening_crawl": "War! The Republic is crumbling\r\nunder attacks by the ruthless\r\nSith Lord, Count Dooku.\r\nThere are heroes on both sides.\r\nEvil is everywhere.\r\n\r\nIn a stunning move, the\r\nfiendish droid leader, General\r\nGrievous, has swept into the\r\nRepublic capital and kidnapped\r\nChancellor Palpatine, leader of\r\nthe Galactic Senate.\r\n\r\nAs the Separatist Droid Army\r\nattempts to flee the besieged\r\ncapital with their valuable\r\nhostage, two Jedi Knights lead a\r\ndesperate mission to rescue the\r\ncaptive Chancellor....", "characters": [ 1, diff --git a/resources/fixtures/people.json b/resources/fixtures/people.json index b020814e..33bb3336 100644 --- a/resources/fixtures/people.json +++ b/resources/fixtures/people.json @@ -104,7 +104,7 @@ { "fields": { "edited": "2014-12-20T21:17:50.319Z", - "name": "Beru Whitesun lars", + "name": "Beru Whitesun Lars", "created": "2014-12-10T15:53:41.121Z", "gender": "female", "skin_color": "light", diff --git a/resources/fixtures/species.json b/resources/fixtures/species.json index d96695c4..3a9e3f39 100644 --- a/resources/fixtures/species.json +++ b/resources/fixtures/species.json @@ -8,10 +8,11 @@ "created": "2014-12-10T13:52:11.567Z", "eye_colors": "brown, blue, green, hazel, grey, amber", "people": [ - 66, - 67, - 68, - 74 + 1, 4, 5, 6, 7, 9, 10, 11, 12, + 14, 18, 19, 21, 22, 25, 26, 28, + 29, 32, 34, 35, 39, 42, 43, 51, + 60, 61, 62, 66, 67, 68, 69, 74, + 81, 82 ], "skin_colors": "caucasian, black, asian, hispanic", "language": "Galactic Basic", diff --git a/run.sh b/run.sh new file mode 100755 index 00000000..434d5af3 --- /dev/null +++ b/run.sh @@ -0,0 +1,4 @@ +#!/bin/sh +python manage.py migrate +make load_data +python manage.py runserver 0.0.0.0:8000 diff --git a/swapi/static/css/custom.css b/swapi/static/css/custom.css index 34f844d1..80fa2f48 100644 --- a/swapi/static/css/custom.css +++ b/swapi/static/css/custom.css @@ -16,5 +16,5 @@ } .subscribe_btn { - margin-left: -100px!; + margin-left: -100px; } diff --git a/swapi/templates/about.html b/swapi/templates/about.html index 516ecca7..a3dce70b 100644 --- a/swapi/templates/about.html +++ b/swapi/templates/about.html @@ -17,20 +17,6 @@

Statistics

{% endmarkdown %}
-

Donate

-

With small donations we can keep swapi running for free, please consider throwing us some beer money to say thank you. With every $10 we can keep the site up for another month!

-

- -

-

We truly appreciate your support

{% endblock mainbody %} diff --git a/swapi/templates/about.md b/swapi/templates/about.md index 070e102c..4f178e74 100644 --- a/swapi/templates/about.md +++ b/swapi/templates/about.md @@ -8,6 +8,10 @@ We've formatted this data in [**JSON**](https://json.org) and exposed it to you [Check out the documentation to get started consuming swapi data](/documentation) +## What happened to swapi.co? +Unfortulately swapi.co is not maintained anymore, and the service is currently down. This is a branch of SWAPI that will be supported going forward. + + ## What can you use this for? Comparing the data from Star Wars has never been easier. Here are some examples using the [Python helper library](/documentation#python) @@ -40,20 +44,17 @@ Comparing the data from Star Wars has never been easier. Here are some examples ## What are the features? We're using [Django](https://djangoproject.com) and [Django REST Framework](https://django-rest-framework.org) to serve a [RESTish](https://en.wikipedia.org/wiki/REST) API to you. - The data is all formatted in [JSON](http://json.org) and we also support [JSON Schema](http://jsonschema.net) for programmatically understanding the attributes of each resource. -We're using [stripe](https://stripe.com) to process our donations. - -## Why did you build this? - -I built the [Pokémon API](https://pokeapi.co) before I built this. I realised that *if you provide data easily, someone will consume it*. I got bored around Christmas 2014 and decided that I'd take what I learned from PokéAPI and build an API for Star Wars data. - Seeing the release trailer for Episode VII also made me stupidly enthusiastic for Star Wars again. ## Who are you? -I am [Paul Hallett](http://phalt.co), a senior software engineer and an infinitely protean machine. +I am [Juriy Bura](https://github.com/juriy), Solution Architect and author of JavaScript game development book and online React courses. + +## Original author? + +This project was originally built and maintained by [Paul Hallett](http://phalt.co). ## Copyright and stuff? @@ -72,3 +73,4 @@ SWAPI would not be possible without contributions from the following people: - [Owen Hallett](https://github.com/Videocard) - [Carvilsi](https://github.com/carvilsi) - [Andrea Stagi](https://github.com/astagi) +- [Juriy Bura](https://github.com/juriy) diff --git a/swapi/templates/base.html b/swapi/templates/base.html index 3ad96858..458e541f 100644 --- a/swapi/templates/base.html +++ b/swapi/templates/base.html @@ -1,6 +1,6 @@ - + @@ -14,6 +14,13 @@ </style> <script src="//code.jquery.com/jquery-2.1.0.min.js"></script> <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script> + <!-- Global site tag (gtag.js) - Google Analytics --> + <script async src="https://www.googletagmanager.com/gtag/js?id=UA-163610532-1"></script> + <script> + window.dataLayer = window.dataLayer || []; + function gtag(){dataLayer.push(arguments);} + gtag('js', new Date()); + gtag('config', 'UA-163610532-1'); </script> </head> <body> @@ -26,7 +33,7 @@ <span class="icon-bar"></span> <span class="icon-bar"></span> </button> - <div class="navbar-brand" href="#"><a href="https://twitter.com/share" class="twitter-share-button" data-url="https://swapi.co" data-text="SWAPI - the Star Wars API " data-via="phalt_" data-related="phalt_">Tweet</a> + <div class="navbar-brand" href="#"><a href="https://twitter.com/share" class="twitter-share-button" data-url="https://swapi.co" data-text="swapi.dev - the Star Wars API " data-via="juriy" data-related="juriy">Tweet</a> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script></div> </div> <div class="collapse navbar-collapse"> @@ -43,29 +50,21 @@ <div class="jumbotron"> <h1>SWAPI</h1> <p class="lead">The Star Wars API</p> + <p class="lead"><a href="/about">(what happened to swapi.co?)</a></p> </div> </div> {% block mainbody %} {% endblock mainbody %} {% block scripts %} {% endblock scripts %} - <script> - (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ - (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), - m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) - })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); - ga('create', 'UA-53299289-3', 'auto'); - ga('send', 'pageview'); - </script> <div class="row"> <div class="col-lg-12 footer"> - <a href="//phalt.co?ref=swapi" target="_blank">© Paul Hallett <script type="text/javascript"> - document.write(new Date().getFullYear()); -</script></a> + Created by Paul Hallett + Maintained by Juriy Bura ©<script type="text/javascript">document.write(new Date().getFullYear());</script> <span class="pull-right"> - <a href="//twitter.com/phalt_" class="twitter-follow-button" data-show-count="false" data-show-screen-name="false" data-dnt="true">Follow me on twitter</a> + <a href="//twitter.com/juriy" class="twitter-follow-button" data-show-count="false" data-show-screen-name="false" data-dnt="true">Follow me on twitter</a> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script> - <iframe src="//ghbtns.com/github-btn.html?user=phalt&type=follow" + <iframe src="//ghbtns.com/github-btn.html?user=juriy&type=follow" allowtransparency="false" frameborder="0" scrolling="0" width="132" height="20"></iframe></span></p> </div> </div> diff --git a/swapi/templates/docs.md b/swapi/templates/docs.md index 9018626c..aa9eb5f6 100644 --- a/swapi/templates/docs.md +++ b/swapi/templates/docs.md @@ -15,7 +15,7 @@ Let's make our first API request to the Star Wars API! Open up a terminal and use [curl](http://curl.haxx.se) or [httpie](http://httpie.org) to make an API request for a resource. In the example below, we're trying to get the first planet, Tatooine: - http swapi.co/api/planets/1/ + http swapi.dev/api/planets/1/ We'll use [httpie](http://httpie.org) for our examples as it displays responses nicely and gives us a whole lot more useful information. If you don't want to download httpie, just use the *curl* command instead. @@ -31,14 +31,14 @@ Here is the response we get: "orbital_period": "304", "population": "200000", "residents": [ - "https://swapi.co/api/people/1/", - "https://swapi.co/api/people/2/", + "https://swapi.dev/api/people/1/", + "https://swapi.dev/api/people/2/", ... ], "rotation_period": "23", "surface_water": "1", "terrain": "Dessert", - "url": "https://swapi.co/api/planets/1/" + "url": "https://swapi.dev/api/planets/1/" } If your response looks slightly different don't panic. This is probably because more data has been added to swapi since we made this documentation. @@ -50,7 +50,7 @@ The **Base URL** is the root URL for all of the API, if you ever make a request The Base URL for swapi is: - https://swapi.co/api/ + https://swapi.dev/api/ The documentation below assumes you are prepending the Base URL to the endpoints in order to make requests. @@ -75,7 +75,7 @@ All resources support [JSON Schema](https://jsonschema.net). Making a request to All resources support a `search` parameter that filters the set of resources returned. This allows you to make queries like: ``` -https://swapi.co/api/people/?search=r2 +https://swapi.dev/api/people/?search=r2 ``` All searches will use case-insensitive partial matches on the set of search fields. To see the set of search fields for each resource, check out the individual resource documentation. For more information on advanced search terms see [here](http://www.django-rest-framework.org/api-guide/filtering/#searchfilter). @@ -98,7 +98,7 @@ Wookiee is for our tall hairy allies who speak Wookiee, this encoding is identic Using the wookiee renderer is easy, just append `?format=wookiee` to your urls: ``` -https://swapi.co/api/planets/1/?format=wookiee +https://swapi.dev/api/planets/1/?format=wookiee ``` #Resources @@ -111,19 +111,19 @@ The Root resource provides information on all available resources within the API **Example request:** - http https://swapi.co/api/ + http https://swapi.dev/api/ **Example response:** HTTP/1.0 200 OK Content-Type: application/json { - "films": "https://swapi.co/api/films/", - "people": "https://swapi.co/api/people/", - "planets": "https://swapi.co/api/planets/", - "species": "https://swapi.co/api/species/", - "starships": "https://swapi.co/api/starships/", - "vehicles": "https://swapi.co/api/vehicles/" + "films": "https://swapi.dev/api/films/", + "people": "https://swapi.dev/api/people/", + "planets": "https://swapi.dev/api/planets/", + "species": "https://swapi.dev/api/species/", + "starships": "https://swapi.dev/api/starships/", + "vehicles": "https://swapi.dev/api/vehicles/" } **Attributes:** @@ -156,7 +156,7 @@ A People resource is an individual person or character within the Star Wars univ **Example request:** - http https://swapi.co/api/people/1/ + http https://swapi.dev/api/people/1/ **Example response:** @@ -166,28 +166,28 @@ A People resource is an individual person or character within the Star Wars univ "birth_year": "19 BBY", "eye_color": "Blue", "films": [ - "https://swapi.co/api/films/1/", + "https://swapi.dev/api/films/1/", ... ], "gender": "Male", "hair_color": "Blond", "height": "172", - "homeworld": "https://swapi.co/api/planets/1/", + "homeworld": "https://swapi.dev/api/planets/1/", "mass": "77", "name": "Luke Skywalker", "skin_color": "Fair", "created": "2014-12-09T13:50:51.644000Z", "edited": "2014-12-10T13:52:43.172000Z", "species": [ - "https://swapi.co/api/species/1/" + "https://swapi.dev/api/species/1/" ], "starships": [ - "https://swapi.co/api/starships/12/", + "https://swapi.dev/api/starships/12/", ... ], - "url": "https://swapi.co/api/people/1/", + "url": "https://swapi.dev/api/people/1/", "vehicles": [ - "https://swapi.co/api/vehicles/14/" + "https://swapi.dev/api/vehicles/14/" ... ] } @@ -245,7 +245,7 @@ A Film resource is a single film. **Example request:** - http https://swapi.co/api/films/1/ + http https://swapi.dev/api/films/1/ **Example response:** @@ -253,7 +253,7 @@ A Film resource is a single film. Content-Type: application/json { "characters": [ - "https://swapi.co/api/people/1/", + "https://swapi.dev/api/people/1/", ... ], "created": "2014-12-10T14:23:31.880000Z", @@ -262,23 +262,23 @@ A Film resource is a single film. "episode_id": 4, "opening_crawl": "It is a period of civil war.\n\nRebel spaceships, striking\n\nfrom a hidden base, have won\n\ntheir first victory against\n\nthe evil Galactic Empire.\n\n\n\nDuring the battle, Rebel\n\nspies managed to steal secret\r\nplans to the Empire's\n\nultimate weapon, the DEATH\n\nSTAR, an armored space\n\nstation with enough power\n\nto destroy an entire planet.\n\n\n\nPursued by the Empire's\n\nsinister agents, Princess\n\nLeia races home aboard her\n\nstarship, custodian of the\n\nstolen plans that can save her\n\npeople and restore\n\nfreedom to the galaxy....", "planets": [ - "https://swapi.co/api/planets/1/", + "https://swapi.dev/api/planets/1/", ... ], "producer": "Gary Kurtz, Rick McCallum", "release_date": "1977-05-25", "species": [ - "https://swapi.co/api/species/1/", + "https://swapi.dev/api/species/1/", ... ], "starships": [ - "https://swapi.co/api/starships/2/", + "https://swapi.dev/api/starships/2/", ... ], "title": "A New Hope", - "url": "https://swapi.co/api/films/1/", + "url": "https://swapi.dev/api/films/1/", "vehicles": [ - "https://swapi.co/api/vehicles/4/", + "https://swapi.dev/api/vehicles/4/", ... ] } @@ -332,7 +332,7 @@ A Starship resource is a single transport craft that has hyperdrive capability. **Example request:** - http https://swapi.co/api/starships/9/ + http https://swapi.dev/api/starships/9/ **Example response:** @@ -354,11 +354,11 @@ A Starship resource is a single transport craft that has hyperdrive capability. "name": "Death Star", "passengers": "843342", "films": [ - "https://swapi.co/api/films/1/" + "https://swapi.dev/api/films/1/" ], "pilots": [], "starship_class": "Deep Space Mobile Battlestation", - "url": "https://swapi.co/api/starships/9/" + "url": "https://swapi.dev/api/starships/9/" } **Attributes:** @@ -419,7 +419,7 @@ A Vehicle resource is a single transport craft that **does not have** hyperdrive **Example request:** - http https://swapi.co/api/vehicles/4/ + http https://swapi.dev/api/vehicles/4/ **Example response:** @@ -441,9 +441,9 @@ A Vehicle resource is a single transport craft that **does not have** hyperdrive "passengers": "30", "pilots": [], "films": [ - "https://swapi.co/api/films/1/" + "https://swapi.dev/api/films/1/" ], - "url": "https://swapi.co/api/vehicles/4/", + "url": "https://swapi.dev/api/vehicles/4/", "vehicle_class": "wheeled" } @@ -501,7 +501,7 @@ A Species resource is a type of person or character within the Star Wars Univers **Example request:** - http https://swapi.co/api/species/3/ + http https://swapi.dev/api/species/3/ **Example response:** @@ -517,18 +517,18 @@ A Species resource is a type of person or character within the Star Wars Univers "edited": "2014-12-10T16:44:31.486000Z", "eye_colors": "blue, green, yellow, brown, golden, red", "hair_colors": "black, brown", - "homeworld": "https://swapi.co/api/planets/14/", + "homeworld": "https://swapi.dev/api/planets/14/", "language": "Shyriiwook", "name": "Wookie", "people": [ - "https://swapi.co/api/people/13/" + "https://swapi.dev/api/people/13/" ], "films": [ - "https://swapi.co/api/films/1/", - "https://swapi.co/api/films/2/" + "https://swapi.dev/api/films/1/", + "https://swapi.dev/api/films/2/" ], "skin_colors": "gray", - "url": "https://swapi.co/api/species/3/" + "url": "https://swapi.dev/api/species/3/" } **Attributes:** @@ -582,7 +582,7 @@ A Planet resource is a large mass, planet or planetoid in the Star Wars Universe **Example request:** - http https://swapi.co/api/planets/1/ + http https://swapi.dev/api/planets/1/ **Example response:** @@ -595,7 +595,7 @@ A Planet resource is a large mass, planet or planetoid in the Star Wars Universe "diameter": "10465", "edited": "2014-12-15T13:48:16.167217Z", "films": [ - "https://swapi.co/api/films/1/", + "https://swapi.dev/api/films/1/", ... ], "gravity": "1", @@ -603,13 +603,13 @@ A Planet resource is a large mass, planet or planetoid in the Star Wars Universe "orbital_period": "304", "population": "120000", "residents": [ - "https://swapi.co/api/people/1/", + "https://swapi.dev/api/people/1/", ... ], "rotation_period": "23", "surface_water": "1", "terrain": "Dessert", - "url": "https://swapi.co/api/planets/1/" + "url": "https://swapi.dev/api/planets/1/" } **Attributes:** @@ -665,6 +665,11 @@ There are a bunch of helper libraries available for consuming the Star Wars API - [SWAPI-Wrapper](https://github.com/cfjedimaster/SWAPI-Wrapper) By [Raymond Camden](https://github.com/cfjedimaster). - [swapi-node](https://www.npmjs.com/package/swapi-node) by [Lucas Holmquist](https://github.com/lholmquist). +<a name="typescript"></a> +##Typescript + +- [swapi-ts](https://github.com/amitmtrn/swapi-ts) by [Amit Choukroun](https://github.com/amitmtrn) + <a name="android"></a> ##Android diff --git a/swapi/templates/index.html b/swapi/templates/index.html index ffbe3763..4cb5e9e6 100644 --- a/swapi/templates/index.html +++ b/swapi/templates/index.html @@ -23,7 +23,7 @@ <h1 class="center"> Try it now! </h1> <div class="input-group"> - <span class="input-group-addon">https://swapi.co/api/</span> + <span class="input-group-addon">https://swapi.dev/api/</span> <input id="interactive" type="text" class="form-control" placeholder="people/1/"> <span class="input-group-btn"><button onClick="interactive_call();return false;" class="btn btn-primary">request</button></span> </div> @@ -40,28 +40,28 @@ <h1 class="center"> "eye_color": "blue", "birth_year": "19BBY", "gender": "male", - "homeworld": "https://swapi.co/api/planets/1/", + "homeworld": "https://swapi.dev/api/planets/1/", "films": [ - "https://swapi.co/api/films/2/", - "https://swapi.co/api/films/6/", - "https://swapi.co/api/films/3/", - "https://swapi.co/api/films/1/", - "https://swapi.co/api/films/7/" + "https://swapi.dev/api/films/2/", + "https://swapi.dev/api/films/6/", + "https://swapi.dev/api/films/3/", + "https://swapi.dev/api/films/1/", + "https://swapi.dev/api/films/7/" ], "species": [ - "https://swapi.co/api/species/1/" + "https://swapi.dev/api/species/1/" ], "vehicles": [ - "https://swapi.co/api/vehicles/14/", - "https://swapi.co/api/vehicles/30/" + "https://swapi.dev/api/vehicles/14/", + "https://swapi.dev/api/vehicles/30/" ], "starships": [ - "https://swapi.co/api/starships/12/", - "https://swapi.co/api/starships/22/" + "https://swapi.dev/api/starships/12/", + "https://swapi.dev/api/starships/22/" ], "created": "2014-12-09T13:50:51.644000Z", "edited": "2014-12-20T21:17:56.891000Z", - "url": "https://swapi.co/api/people/1/" + "url": "https://swapi.dev/api/people/1/" } </pre> </div> @@ -83,20 +83,10 @@ <h4 class="center">How can I use it?</h4> <p>Helper libraries for popular programming languages are also provided so you can consume swapi in your favourite programming language, in a style that suits you.</p> </div> <div class="col-sm-3 col-lg-3 col-md-3"> - <h4 class="center">How can I support this?</h4> - <p>With small donations we can keep swapi running for free, please consider throwing us some beer money to say thank you. With every $10 we can keep the site up for another month!</p> -<p><form action="/stripe/donation" method="POST"> - <script - src="https://checkout.stripe.com/checkout.js" class="stripe-button" - data-key="{{stripe_key}}" - data-image="https://i.imgur.com/PqkJzx4s.png" - data-name="swapi.co" - data-description="Donate and keep swapi alive!" - data-amount="1000" - data-panel-label="Donate"> - </script> - </form></p> - <p>This project is open source and you can contribute <a href="https://github.com/phalt/swapi">on GitHub</a>.</p> + <h4 class="center">What happened with old swapi.co?</h4> + <p>swapi.co is not supported and maintained anymore. But since so many projects and tutorials used it as their educational + playground, this is an "unofficial" branch.</p> + <p>This project is open source and you can contribute <a href="https://github.com/Juriy/swapi">on GitHub</a>.</p> </div> <div class="col-sm-1 col-lg-1 col-md-1"> </div> diff --git a/swapi/templates/rest_framework/api.html b/swapi/templates/rest_framework/api.html index 70713d3c..51da42b4 100644 --- a/swapi/templates/rest_framework/api.html +++ b/swapi/templates/rest_framework/api.html @@ -12,7 +12,7 @@ <span class="icon-bar"></span> <span class="icon-bar"></span> </button> -<div class="navbar-brand" href="#"><a href="https://twitter.com/share" class="twitter-share-button" data-url="https://swapi.co" data-text="SWAPI - the Star Wars API " data-via="phalt_" data-related="phalt_">Tweet</a> +<div class="navbar-brand" href="#"><a href="https://twitter.com/share" class="twitter-share-button" data-url="https://swapi.co" data-text="SWAPI - the Star Wars API " data-via="juriy" data-related="juriy">Tweet</a> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script></div> </div> <div class="collapse navbar-collapse">