This repository contains the solution for the homework assignment for the Data Source API Analyst role. The project focuses on interacting with the GitHub REST API to extract data related to repositories, commits, and contents. The implementation demonstrates proficiency in API interaction, troubleshooting, and proper documentation.
/Content
-
- API_Documentation.md: Details of the GitHub API endpoints used.
-
- Troubleshooting_Guide.md: Solutions for common issues during API interaction.
-
- Github_API_Test.postman_collection.json: Postman collection containing API requests.
-
- /Responses: Contains responses in three json files and detail API setup
README.md
The client required data extraction for the following:
- Search Public Repositories: Retrieve a list of public repositories for a given user or organization.
- Commits: Fetch commit history for specific repositories.
- Contents: Retrieve the content of a file or directory within a repository.
Key considerations during API research included:
- Requests Logic: Understanding required parameters and response structures.
- Pagination: Managing results spread across multiple pages.
- Rate Limits: Monitoring API limits and handling retries.
- Authentication: Using a personal access token for secure access.
Refer to API_Documentation.md
for endpoint details and sample responses.
- Repository Name:
Data-Source-API-Analyst-Test
- Description: "Homework assignment for the Data Source API Analyst role."
- Visibility: Public
Structure: Organized into /Content
for documentation and /Postman_Collection
for API requests.
-
Environment Setup
A Postman environment namedGitHub
was created with the following variables:base_url
:https://api.github.com
username
: GitHub username.auth_token
: Personal access token with appropriate permissions.
-
API Endpoints
Configured and tested the following:- Search Public Repositories:
/users/{username}/repos
- Repository Commits:
/repos/{owner}/{repo}/commits
- Repository Contents:
/repos/{owner}/{repo}/contents/{path}
- Search Public Repositories:
-
Pagination and Rate Limits
- Pagination handled using the
page
andper_page
query parameters. - Rate limits monitored via headers:
X-RateLimit-Remaining
andX-RateLimit-Reset
.
- Pagination handled using the
-
Response Testing
- Verified and saved response samples for correctness.
Common issues and their solutions are documented in /Content/Troubleshooting_Guide.md
.
Example:
- 401 Unauthorized Error:
- Check Authentication: Ensure the
auth_token
is valid and has necessary permissions. - Verify Environment Variables: Make sure the environment variables in Postman are correctly set.
- Monitor Rate Limits: Apply retries if necessary.
- Check Authentication: Ensure the
-
Postman Collection Export
The requests are saved in the Postman collection file:
/Postman_Collection/Github_API_Test.postman_collection.json
. -
Reflection
- This task demonstrated the ability to effectively interact with REST APIs using Postman.
- Postman provided an intuitive interface for testing and troubleshooting requests.
- Clone this repository:
git clone https://github.com/Tuoleken/Data-Source-API-Analyst-Test.git
- Import the Postman collection file from /Postman_Collection into Postman.
- Set up the GitHub environment with your credentials (auth_token, username).
- Test the configured API endpoints or modify them as needed.