The Launch Library 2 API (LL2 for short) enables you to request space related data such as launches, astronauts, etc. A full list of features can be found here.
To get you started with the API, this tutorial contains some introduction information together with code examples. For more detailed documentation on all the endpoints, please refer to the documentation.
Since the production API ll
has rate limits, the development API lldev
will be used in this tutorial, however this should only by used for development.
To query data, endpoint URLs are used. Filters and search terms can be added to these.
Querying the upcoming launch endpoint: https://lldev.thespacedevs.com/2.3.0/launches/upcoming/
Adding filters is done by adding them to the base url.
Filtering
Here two filters are added, a minimum and maximum date and time to get the launches between the two.
The time frame of the minimum and maximum are a month ago and now.
The filtered variable is net
, which represents the launch datetime.
To filter net
we add two underscores __
and the filter terms gte
(greater-than-or-equal) and lte
(less-than-or-equal).
Combining these two filters is done using the ampersand symbol &
.
Before adding these filters a question mark ?
is added after the base url to indicate the start of parameters.
Then the filter parameter name is given with an equals sign =
with the value following it.
Tutorials/tutorials/getting_started_LL2/launches_past_month.py
Lines 7 to 12 in 1b1a40a
Setting response mode
Tutorials/tutorials/getting_started_LL2/launches_past_month.py
Lines 23 to 24 in 1b1a40a
Limiting
Tutorials/tutorials/getting_started_LL2/launches_past_month.py
Lines 26 to 27 in 1b1a40a
Ordering
Tutorials/tutorials/getting_started_LL2/launches_past_month.py
Lines 29 to 30 in 1b1a40a
Assembling query URL
Tutorials/tutorials/getting_started_LL2/launches_past_month.py
Lines 32 to 36 in 1b1a40a
Paginating through all the results
Tutorials/tutorials/getting_started_LL2/launches_past_month.py
Lines 91 to 110 in 1b1a40a