Skip to content

Blog Endpoints

Jay Gadi edited this page Jun 3, 2021 · 1 revision

Description

This endpoint section is used for recommending blogs from the Soapbox marketing website based on specific categories. Note that blogs are tagged on the backend with the same categories as in this repository.

Endpoints

1) GET /blogs

This is used for retrieving recommended blogs from the Soapbox marketing website. This works by passing in the categories you want to get recommendations from.

Here are the list of available categories: Communication, Growth, Motivation, or Work.

Request

/blogs?first_category=<category>&second_category=<category>

  1. first_category: This works by passing it in the GET request call with one of the valid categories.

  2. second_category (optional): This works by passing it in the GET request call with one of the valid categories. Please note this argument is optional.

Response

[
    {
        "author": "Mike Arnone",
        "categories": [
            "Employee Motivation",
            "Building Trust",
            "Employee Engagement",
            "Feedback"
        ],
        "description": "Learn about the importance of employee recognition and how to build a culture of kudos within your organization.",
        "image": "https://soapboxhq.com/wp-content/uploads/2019/07/employee-recognition-create-a-culture-of-kudos-in-the-workplace.jpg",
        "link": "https://soapboxhq.com/blog/employee-motivation/employee-recognition-creating-a-culture-of-kudos",
        "published_date": "2019-07-17T14:21:16+00:00",
        "title": "Employee recognition: Creating a 'Culture of Kudos' | SoapBox"
    },
    {
        "author": "Paige Magarrey",
        "categories": [
            "Communication",
            "Employee Motivation",
            "Employee Engagement",
            "One-On-Ones"
        ],
        "description": "Amazing managers swear by one-on-ones as the most important thing they do to lead their teams. Here are seven reasons why amazing managers do one-on-ones.",
        "image": "https://soapboxhq.com/wp-content/uploads/2018/08/[email protected]",
        "link": "https://soapboxhq.com/blog/communication/why-amazing-managers-do-one-on-ones",
        "published_date": "2018-08-22T15:31:03+00:00",
        "title": "7 Reasons Why Amazing Managers Do One-on-ones | SoapBox"
    }
]

Notes

Here are the steps to fetch blog posts:

The easy way

  1. Ensure that Docker container is running.

  2. If you only want to scrape actionable blogs, then hit the following endpoint: /rescrape_blogs?only_actionable=true, otherwise hit the following endpoint /rescrape_blogs

  3. It may take a couple of minutes to get a response. If successful, you should receive the following response:

{
    "Message": "Successfully re-scraped the blog"
}

The CLI way

  1. Ensure that the Docker container is running.

  2. Shell into the Docker container in a new terminal window using sudo docker exec -it ml-api /bin/bash.

  3. Run cd api.

  4. If you only want to scrape actionable blogs run python3 get_blogs.py actionable otherwise run python3 get_blogs.py.

Clone this wiki locally