Skip to content

Instantly share code, notes, and snippets.

@mratzloff
Last active February 8, 2024 00:06
Show Gist options
  • Save mratzloff/c6faddca849542d06938e8e1ddf9bb58 to your computer and use it in GitHub Desktop.
Save mratzloff/c6faddca849542d06938e8e1ddf9bb58 to your computer and use it in GitHub Desktop.
API Coding Challenge

REQUIREMENTS

This coding exercise is an opportunity for you to show us how you break down product requirements into actual code, as well as to demonstrate quality, coding style, experience, and creativity in problem solving. It will also introduce you to the Bitly API and expose you to some of the functionality the back-end team develops on a daily basis. This task is designed to be relevant to the kind of work backend engineers at Bitly do. You should not expect there to be any gotchas.

Bitly Access Token

  • In order to make use of our API, you will need a Bitly Access Token.
    1. Sign up for a Bitly account if you do not already have one.
    2. Visit this page to get your Access Token.
  • Due to security concerns, do not include your access token as part of the submission. We will immediately reject any submission containing an access token!!!

Language and Framework

Feel free to choose any language and framework you are comfortable with. Our preferred language at Bitly is Go, however, you should not feel pressured to use Go if you are not currently comfortable with it. We want you to be able to focus more on your solution than the tools and language.

Project Setup

  • Send us a runnable server that will respond to requests via HTTP
  • Please include a README file including:
    • a writeup describing major design decisions that you made
    • a list of dependencies of your project, as well as how to install them (we may not be experts in your chosen language, framework, and tools)
    • descriptions of any endpoints you are exposing, along with example requests (curl or similar is fine)
    • instructions for running your application (you may include a Dockerfile or a Makefile, but this is not a requirement)

The Problem

We would like your server to expose an endpoint to provide the average number of daily clicks Bitlinks in the user's default group received from each country over the last 30 days. In other words, you will want to divide the number of clicks from each country by the total number days included (30).

The relevant Bitly API endpoints for this task are:

Construct an API service that exposes this data as JSON over HTTP. You can assume the API endpoint you write will take an access token as input.

Note: The Bitly API contains the endpoint https://api-ssl.bitly.com/v4/groups/{group_guid}/countries. You will not want to use this endpoint in your solution, as it returns similar but different results. However, you may use its response structure as a model for your own.

Notes
  • Bitly Glossary:
    • Bitlink - the short link created by the Bitly platform
    • decode/user click - a metric collected each time a Bitlink is accessed and performs the redirect
    • group - a way of organizing and controlling access to data between multiple users in an organization
    • Long URL - the destination redirect of a Bitlink
  • The problem description is intentionally open-ended as we would like to see how you explore the dataset and expose a logical, reasonably performant API to the data.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment