/rs-api

recsysproject

Primary LanguagePythonApache License 2.0Apache-2.0

RS API

MarineGEO circle logo

Getting Started

Installation

uvicorn api.main:app --host 0.0.0.0 --port 8818

  1. Clone the repository:

    git clone https://github.com/Nebula-Heroes/rs-api
  2. Load environment variables from .env file:

    export $(cat .env | xargs)
  3. Build and run the Docker containers:

    docker-compose up --build -d

This command will build the Docker image for the Luxey API and start the container.

  1. Access the API:

The API will be available at http://localhost:8818. You can use tools like cURL or Postman to make requests to the API endpoints.

API Endpoints and Documentation

  1. Get article [Product]

    GET /api/get_article?contentid={content_id}

    Returns the article with the given id. Example: http://api.recsysproject.tech/api/get_article?content_id=2480569770059008227 Example: http://localhost:8818/api/get_article?content_id=2480569770059008227

  2. Add user interaction [Product]

    GET /api/interaction(user_id: str &
                        event_type: str &
                        content_id: str &
                        session_id: str &
                        user_agent: str &
                        user_region: str &
                        user_country: str
    event_type 'VIEW', 'LIKE', 'BOOKMARK', 'FOLLOW', 'COMMENT CREATED'

} Adds a user interaction to the database. Example: http://api.recsysproject.tech/api/interaction?user_id=29888888888&event_type=VIEW&content_id=4109618890343020064&session_id=7899999999999&user_agent=Mozilla%20SPAM%20LINH%20TINH&user_region=US&user_country=USA Example: http://localhost:8818/api/interaction?user_id=29888888888&event_type=VIEW&content_id=4109618890343020064&session_id=7899999999999&user_agent=Mozilla%20SPAM%20LINH%20TINH&user_region=US&user_country=USA

  1. Get homepage articles [home]
    GET /api/recommend_homepage_articles?user_id={user_id}
    Returns the articles on the homepage. Example: http://api.recsysproject.tech/api/recommend_homepage_articles?user_id=-9150583489352258206 Example: http://localhost:8818/api/recommend_homepage_articles?user_id=-9150583489352258206
  2. Get recommended articles (By Like button) [Product]
    GET /api/recommend_liked_articles?content_id={content_id}
    Returns the recommended articles for the user. Example: http://api.recsysproject.tech/api/recommend_liked_articles?content_id=2480569770059008227 Example: http://localhost:8818/api/recommend_liked_articles?content_id=2480569770059008227
  3. Get recommended articles (By follow button) [Product]
    GET /api/recommend_followed_articles?author_person_id={author_person_id}
    Returns the recommended articles for the user. Example: http://api.recsysproject.tech/api/recommend_followed_articles?author_person_id=-2979881261169775358 Example: http://localhost:8818/api/recommend_followed_articles?author_person_id=-2979881261169775358
  4. Get recommended articles (related articles) [Product]
    GET /api/recommend_related_articles?user_id={user_id}
    Returns the recommended articles for the user. Example: http://api.recsysproject.tech/api/recommend_related_articles?userid=-9150583489352258206 Example: http://localhost:8818/api/recommend_related_articles?userid=-9150583489352258206