Uncategorized

Connecting with CURL

Jana is connected with a ton of mobile operators and intermediary vendors that help us give free internet to all of our members.  I’ve done a lot of work over my past year here integrating new partners into our platform to help us get more internet to more people reliably.  One of the awesome parts of this work is speaking to engineers around the world – but different timezones and translated API documentation can definitely make it difficult to figure out exactly why my api requests aren’t getting through.

(http://ruslanspivak.com/lsbaws-part1/)

Enter my good friend curl – a command line tool to “transfer data from or to a server” (from the curl man page).  The python requests library is awesome, and something we use for our production code, but curl is lightweight and sends the information directly to the server.  Here are a couple of useful options that helped me out on my last integration:


-X <GET/POST> all of our integrations HTTP, this lets your specify the verb for the request

--data "@<filename.xml>" this was a soap integration, so it had a lot of data to send. This made it easy to send data from a file for the POST request

-H "<header:value>" if you need multiple headers, you can use multiple -H flags for each one

-E <certificate_file> there are a lot of ways to authenticate http requests, in addition to -u for username, you can send client certificates. I also added the --insecure flag, to signal that I didn't care about their certificates, because I just wanted my requests to go through

Another benefit of curl: We ran into a bug where our integration was failing on prod and only on prod because of the openssl version.  With curl, we logged into the production machines and were able to test various theories without re-releasing code (we ended up forcing TLSv1 for the connection).

 

curl – working hard for you

(http://www.exerciseplace.org/april.html)

 

Software isn’t created in a vacuum – it’s as diverse as the people who work on it. Think it sounds awesome to work with engineers across the world? We’re hiring!

Discussion

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s