Skip to content

Commit

Permalink
Restructured lessons
Browse files Browse the repository at this point in the history
  • Loading branch information
Sidra committed Nov 3, 2024
1 parent a5a3304 commit bc43c7e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
13 changes: 13 additions & 0 deletions _episodes/04-Creating URL queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,17 @@ Using this endpoint, you can retrieve photos captured by a specified Mars rover.

## Creating an API query using the NASA API


### Public API Calls (No API Key Required):
Some APIs/API endpoints, like the NASA Image Search API endpoint, allow users to make requests without an API key. These are often simpler to use and are publicly accessible. For example:
~~~
https://images-api.nasa.gov/search?q=apollo&description=moon&media_type=image&page_size=1
~~~
This URL searches the NASA Image API for images related to “Apollo” with a description of “moon” and limits the result to one image. Anyone can use this without registering for an API key.

### Authenticated API Calls (API Key Required):
Other APIs/endpoints, such as NASA’s Astronomy Picture of the Day (APOD) API endpoint, require an API key to track usage and ensure fair access. This adds a layer of security and allows the provider to monitor or limit the number of requests.

Let's construct an API query to try, querying the Astronomy Picture of the Day (APOD).
The first step is to read and understand the API documentation. They also provide example queries in which you can see that NASA
expects the API key to be encoded as a query parameter.
Expand All @@ -95,6 +106,8 @@ expects the API key to be encoded as a query parameter.
https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY
~~~

Here, the api_key parameter is used to pass the user’s unique key. While DEMO_KEY works for limited testing, registered users receive their own key to access more robust usage.

~~~
{
"date": "2024-11-03",
Expand Down
15 changes: 0 additions & 15 deletions _episodes/05-API queries in python.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,6 @@ keypoints:
- "Some services offer a demo key for testing with limited functionality."
---


# Public API Calls (No API Key Required):
Some APIs/API endpoints, like the NASA Image Search API endpoint, allow users to make requests without an API key. These are often simpler to use and are publicly accessible. For example:
~~~
https://images-api.nasa.gov/search?q=apollo&description=moon&media_type=image&page_size=1
~~~
This URL searches the NASA Image API for images related to “Apollo” with a description of “moon” and limits the result to one image. Anyone can use this without registering for an API key.

# Authenticated API Calls (API Key Required):
Other APIs/endpoints, such as NASA’s Astronomy Picture of the Day (APOD) API endpoint, require an API key to track usage and ensure fair access. This adds a layer of security and allows the provider to monitor or limit the number of requests. For example:
~~~
https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY
~~~
Here, the api_key parameter is used to pass the user’s unique key. While DEMO_KEY works for limited testing, registered users receive their own key to access more robust usage.

# Making API requests in Python
## Essential Libraries

Expand Down

0 comments on commit bc43c7e

Please sign in to comment.