Using an API, and my astounding lack of Ruby knowledge

So I actually did a good deal of real world API learning at work today. We offer web to leads capabilities and a free and open API for our customers, and while I understand the w2l enough to help people with questions, the API has always been shrouded in a veil of mystery to me. This is one of the main reasons I veered off my HTML/CSS course to come and spruce up my API skills.

I had a customer who was looking to find a record in their account, and then set one of the date fields for it. Using apigee, I was able to do the following requests. To GET information from that record, they need to do something like this:

1

So what does this mean? Basically, it’s a call (which apparently is another word for a request) asking the server for information on the deal. The /deals/5132932 is using the deal’s unique internal id number, which we give to each deal entered into our system, to tell it which deal we’re looking for. I believe the .json is telling it we want the response to be in JSON, and finally, the api_key section at the end is identifying us, the client, to the server to give us access to the data in that account.

Now, they wanted to write to the closed_time field for that deal, which is when the deal closed. To do this, they also needed to set the deal to its “Won” stage, and set the probability of the deal closing to “100%”. This is what that request looked like:

2

So it looks just like it did before, but now that we’re using the PUT verb, we’re telling the server to update information on that record rather than retrieve it for us. For each part we needed to update, we would add:

“&deal[thing-to-update]” and then set that equal to the value we were looking for.

It felt really cool to actually put what I’ve learned into real world practice, and even better knowing and using the correct terms for things.


Today I also started the part of the codecademy course where you actually use the twitter api.

First thing they had me do was register a new application with twitter, so that I could click Create my Access token, to get my consumer key, consumer secret, access token and access secret. Can’t wait to fin out what all these actually do.

At this point and on the next example I hit a crossroads. I feel like my ruby knowledge is not nearly up to par to move forward with this, and that seems like a prerequisite here. At the same time, I don’t want to veer too far off the HTML/CSS path I started, as I feel like those are the heart of all websites and I want to understand them very fully and not forgot the details of what I’ve learned.

So, while I’m proud of what I’ve learned with the API stuff the past week and a half, I believe it’s time for me to spend a week back in HTML/CSS land. I feel like it will refresh and reenforce my knowledge there, and then I can move onto the Ruby tutorial with more confidence.

Advertisements

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