The API Challenge

Bore Collins
3 min readJun 14, 2017

--

It wouldn’t be a very good programmer’s resources if it didn’t have an API, would it?

The Application Programming Interface is a term that took me long to comprehend when I was just starting out. It was scary. But after constant rubbing of shoulders with other programmers and more experienced devs, I slowly began getting the hang of it and nowadays I like describing it with how armies used to get and send reinforcements and supplies from their base camps to the soldiers in the battle front.

The battle of the armies

The advance team would be sent to spy and set up cavalry divisions for their soldiers near the enemy’s camp. This team would carry supplies enough to get them to the war front and back.

In the mean time, the foot soldiers would be training hard and ensure they were battle-fit. Once the advance team was back, they would get their response and head for the front — where they would then launch an offensive.

At that time the enemies are also well prepared and they would often retaliate fiercely. Within some days of aggressive fights, the attacking team’s supplies would diminish. Their division heads would then send a reinforcement message back to their camp and ask for more soldiers and supplies like food.

An API works like that. You can think of it as a reinforcement camp where different divisions from different locations go and get supplies at different times, for their teams.

If the attacking team was strong enough, they would lay the enemy on siege and block all entry and exit points to their camp, like what the Oman Arabs did for the Portuguese at Fort Jesus in what has been popularly termed The Siege of Fort Jesus. The Portuguese were now deprived of food and water as they could not receive them from outside the fort. This is what happens when Twitter becomes unfriendly to developers.

APIs Are Like User Interfaces — Just With Different Users in Mind.

Though I had a simple idea of how APIs work, today’s interaction with it using a command line application wasn’t that fruitful. I found out of this awesome HTTP command line client. It is very easy to use in the terminal.

With just a line of code, you can post a comment to an issue on Github. Paste the following command into your terminal and press enter:

http -a your_github_username POST https://api.github.com/repos/jakubroztocil/httpie/issues/83/comments body='HTTPie is awesome! :heart:'

This will get the URL to post your comment to- jakubroztocil’s issue #83 and then it will post your comment to the thread.

No go here and check out your new comment!

The problem came when I lifted the code to a file to a terminal_app.py file and tried running python terminal_app.py . It gave me a syntax error message. My facilitator directed me to check out docopt but time was limited, plus it’s a very technical documentation.

I will definitely seat fellow teammates to work it with me.

So far, that has been my Andela Kenya Boot camp experience, Day 3. It’s getting more gruesome.

--

--

Bore Collins

Software Engineer. Startup Enthusiast. Passionate about passion. Children’s Best Friend. Christian.