DEV Community

˗ˏˋ Ramy ˎˊ˗
˗ˏˋ Ramy ˎˊ˗

Posted on

3 APIs to build with this weekend

APIs are fun to tinker with while learning and can also save you huge amounts of time while building new products or features.

Every week I scour the web for new and interesting APIs. Here are 3 I found recently:

Smart Reply API

This API essentially auto creates replies to messages for you. You give it a message (text message, comment, email, etc.) and it generates a reply for you. If you've use Gmail, you'll likely have seen a Smart Reply type feature in action already.

// Example request and response

// GET request with these params
{
    "text": "I love your shirt.",
    "domain": "socialmedia",
    "language": "en",
    "limit": "1"
}

// Response
{
    4 items
        "generationId": 10 "language": "en"
    "smartReplies": [1 item
        0: {
            2 items "reply": "Thanks! It's from J. Crew!"
            "score": 0.9463478434695229
        }
    ]
    "text": "I love your shirt."
}
Enter fullscreen mode Exit fullscreen mode

Sendblue

This simple API essentially lets you send iMessages. If you try sending to a number that doesn't support iMessage, it's sent as a regular SMS.

// Example request and response

// POST request with these params
{
    number: '+19998887777',
    content: 'Hello world!',
    statusCallback: 'https://example.com/message-status/1234abcd',
}

// Posted to the callback URL
{
    "accountEmail": "support@sendblue.co",
        "content": "Hello world!",
        "is_outbound": true,
        "status": "DELIVERED",
        "error_code": null,
        "error_message": null,
        "message_handle": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
        "date_sent": "2020-09-10T06:15:05.962Z",
        "date_updated": "2020-09-10T06:15:14.115Z",
        "from_number": "+15122164639",
        "number": "+19998887777",
        "to_number": "+19998887777",
        "was_downgraded": false,
        "plan": "blue"
    }
Enter fullscreen mode Exit fullscreen mode

SerpApi

This API returns Google search results as JSON. The powerful part is that it lets you specify which countries to return the search results from.

// Example request and response

// GET request with these params
{
    q: "Coffee",
    location: "Austin, Texas, United States",
    hl: "en",
    gl: "us",
    google_domain: "google.com",
    api_key: "secret_api_key"
}

// Response
{
    "search_metadata": {
        "id": "5f74b763ca38dc4c78553613",
        "status": "Success",
        "json_endpoint": "https://serpapi.com/searches/22885aeb222d98c2/5f74b763ca38dc4c78553613.json",
        "created_at": "2020-09-30 16:50:43 UTC",
        "processed_at": "2020-09-30 16:50:43 UTC",
        "google_url": "https://www.google.com/search?q=Coffee&oq=Coffee&uule=w+CAIQICIaQXVzdGluLFRleGFzLFVuaXRlZCBTdGF0ZXM&hl=en&gl=us&sourceid=chrome&ie=UTF-8",
        "raw_html_file": "https://serpapi.com/searches/22885aeb222d98c2/5f74b763ca38dc4c78553613.html",
        "total_time_taken": 2.76
    },
    "search_parameters": {
        "engine": "google",
        "q": "Coffee",
        "location_requested": "Austin, Texas, United States",
        "location_used": "Austin,Texas,United States",
        "google_domain": "google.com",
        "hl": "en",
        "gl": "us",
        "device": "desktop"
    },
    "search_information": {
        "organic_results_state": "Results for exact spelling",
        "total_results": 3090000000,
        "time_taken_displayed": 0.88,
        "query_displayed": "Coffee"
    },
    "local_map": {
        "link": "https://www.google.com/search?gl=us&hl=en&q=Coffee&npsic=0&rflfq=1&rldoc=1&rlha=0&rllag=30267376,-97742553,138&tbm=lcl&sa=X&ved=2ahUKEwip4-2cq5HsAhVvkuAKHVHlCaEQtgN6BAgdEAc",
        "gps_coordinates": {
            "latitude": 30.267376,
            "longitude":
                -97.742553,
            "altitude": 138
        }
    },
    "local_results": {
        "more_locations_link": "https://www.google.com/search?gl=us&hl=en&q=Coffee&npsic=0&rflfq=1&rldoc=1&rlha=0&rllag=30267376,-97742553,138&tbm=lcl&sa=X&ved=2ahUKEwip4-2cq5HsAhVvkuAKHVHlCaEQjGp6BAgdEFA",
        "places": [{
                "position": 1,
                "title": "Starbucks",
                "place_id": "10605736027611436825",
                "lsig": "AB86z5XTJ_Io_anVBu2fU6Zaqu3b",
                "place_id_search": "https://serpapi.com/search.json?device=desktop&engine=google&gl=us&google_domain=google.com&hl=en&location=Austin%2C+Texas%2C+United+States&lsig=AB86z5XTJ_Io_anVBu2fU6Zaqu3b&ludocid=10605736027611436825&q=Coffee&tbm=lcl",
                "rating": 4.1,
                "reviews": 480,
                "price": "$$",
                "type": "Coffee shop",
                "address": "600 Congress Ave Ste. G-270",
                "thumbnail": ,
                "service_options": {
                    "dine_in": false,
                    "takeout": true,
                    "delivery": true
                },
                "gps_coordinates": {
                    "latitude": 30.268272,
                    "longitude":
                        -97.74294
                }
            },
            {
                "position": 2,
                "title": "Houndstooth Coffee",
                "place_id": "11265938073076301333",
                "lsig": "AB86z5Vdw6C2pJpM0xQ6JUx2KONU",
                "place_id_search": "https://serpapi.com/search.json?device=desktop&engine=google&gl=us&google_domain=google.com&hl=en&location=Austin%2C+Texas%2C+United+States&lsig=AB86z5Vdw6C2pJpM0xQ6JUx2KONU&ludocid=11265938073076301333&q=Coffee&tbm=lcl",
                "rating": 4.6,
                "reviews": 703,
                "price": "$$",
                "type": "Coffee shop",
                "address": "401 Congress Ave #100c · In Frost Bank Tower",
                "thumbnail": ,
                "service_options": {
                    "dine_in": false,
                    "takeout": true,
                    "delivery": false
                },
                "gps_coordinates": {
                    "latitude": 30.26618,
                    "longitude":
                        -97.742905
                }
            }

// ...... (too long to share the full response, but you get the point)
Enter fullscreen mode Exit fullscreen mode

I'm not affiliated with any of these APIs, but I have started a newsletter where I share new & interesting APIs I come across. If you've recently come across an API that other developers would find interesting, please let me know

Oldest comments (2)

Collapse
 
pujux profile image
Julian Pufler

Cool Article! Me and a few other people have been building disease.sh for the last couple of months! You might wanna check it out :)

Collapse
 
ramykhuffash profile image
˗ˏˋ Ramy ˎˊ˗

Thanks - will check this out :-)