No description
  • JavaScript 100%
Find a file
2025-11-05 13:59:13 -06:00
node_modules Creating Base & AI generated README to test myself and quiz myself with 2025-11-03 22:18:40 -06:00
Deliverable.js Finished Donshay's Deliverables 2025-11-05 13:59:13 -06:00
package-lock.json Creating Base & AI generated README to test myself and quiz myself with 2025-11-03 22:18:40 -06:00
package.json Creating Base & AI generated README to test myself and quiz myself with 2025-11-03 22:18:40 -06:00
README.md Creating Base & AI generated README to test myself and quiz myself with 2025-11-03 22:18:40 -06:00
Server.js Finished Donshay's Deliverables 2025-11-05 13:59:13 -06:00

API Practice

This project is for me to practice how to interact with API's with JavaScript & Postman. I intend to answer the following questions with this lesson:

  1. How do I make a GET request to retrieve data?
  2. How do I make a POST request to send data?
  3. How do I handle errors when interacting with an API?

Table of Contents

Setup

Prerequisites

  • Node.js installed on your machine.
  • Postman for API testing.

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/API-Practice.git
    
  2. Navigate to the project directory:

    cd API-Practice
    
  3. Install any necessary dependencies (if any):

    npm install
    

Usage

Making GET Requests

To make a GET request, you can use JavaScript with the fetch API or Postman.

Using JavaScript:

fetch('https://api.example.com/data')
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error('Error:', error));

Using Postman:

  1. Open Postman.
  2. Select the GET method.
  3. Enter the URL: https://api.example.com/data.
  4. Click "Send".

Making POST Requests

To make a POST request, you can use JavaScript with the fetch API or Postman.

Using JavaScript:

const data = {
  name: 'John Doe',
  email: 'john.doe@example.com'
};

fetch('https://api.example.com/data', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify(data)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));

Using Postman:

  1. Open Postman.
  2. Select the POST method.
  3. Enter the URL: https://api.example.com/data.
  4. Go to the "Body" tab and select "raw".
  5. Choose "JSON" from the dropdown.
  6. Enter your JSON data:
    {
      "name": "John Doe",
      "email": "john.doe@example.com"
    }
    
  7. Click "Send".

Contributing

Contributions are welcome! Please read our CONTRIBUTING.md file for details on how to contribute.

License

This project is licensed under the MIT License - see the LICENSE file for details.


Feel free to modify this template to fit your specific needs and questions.