Skip to content

Latest commit

 

History

14 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Giphy API Integration Service

Features

  • Giphy API Integration: Fetch GIFs based on search terms.
  • Response Formatting: Support for JSON, XML, and Protobuf formats.
  • API Key Management: Create and delete API keys using SQLite.
  • Endpoints:
    • /giphy: Fetch GIFs using the Giphy API.
    • /api-key (POST/DELETE): Manage API keys.
  • Authentication: API key-based authentication using middleware.
  • Caching: Caching using redis for a faster response time when querying the same thing.

caching response time

*first request is before getting cached and second request is after getting cached and the significant improvement in response time*
- **Containerization**: Docker support with Docker Compose for easy setup.

Endpoints

  1. GET /giphy

    • Query Params:
      • q: Search term for GIFs.
      • o: (Optional) Response format - json, xml, or protobuf.
    • Response: GIFs matching the search query in the requested format.
  2. POST /api-key

    • Description: Create a new API key.
    • Response: Returns the newly created API key.
  3. DELETE /api-key

    • Description: Delete an existing API key.
    • Parameters:
      /api-key/:id
      
    • Response: Confirmation of deletion.

Setup

  1. Clone the Repository
    git clone git@github.com:zokhcat/giphyscraper.git
    cd giphyscraper
    
  2. Configure Giphy API Key
  • Add your Giphy API key to .env file:

   GIPHY_API_KEY=<your-api-key>
  • Run the service locally

   docker compose up

Access the API

Service will be available at http://localhost:8080.

Middleware

The API uses a middleware to validate API keys for /giphy route

Tech Stack

  • Golang
  • SQLite for API key storage
  • Redis for caching
  • Docker & Docker Compose for containerization

Implementation Flow:

  • Giphy API integration
    • Setup Giphy API client
    • Function to fetch GIFs and parse Giphy API response
  • Response Formatting
    • Implement JSON formatting
    • Implement XML formatting
    • Research and implement Protobuf formatting
  • API Key Management
    • Implement SQLite db
    • Create DB model
    • API Key create, delete function
  • API endpoints(router)
    • Implement /giphy endpoint
    • Implement /api-key POST to create API key
    • Implement /api-key DELETE to delete API key
    • Write a middleware for API-key in /giphy route
  • Containerize the application using Docker
  • Docker Compose

Extra Features I want to implement

  • Implement caching using redis

About

Giphy Scraper API

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages