2 Replies - 1145 Views - Last Post: 06 January 2014 - 10:33 PM

#1 Lapys  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 03-January 14

Creating a Web API Client Library?

Posted 06 January 2014 - 02:16 PM

This question as a whole is not language specific, but I will refer to some examples specifically.

I was asked recently to create a client library (in C++)for a Web API. Not really knowing how to do this, I became frustrated and tried to do some research on how one would go about building a client library from the ground up. I've used some libraries before of course, so I get the concept of what they are and how to use them, but I don't really understand how to interface them with a Web API (obviously this will alter drastically per the API), or how to go about building the library itself.

I've met lots of tutorials on using libraries, using APIs, and some basic API creating tutorials, but nothing really on making your own library that interfaces with an API. It's something I'm interested in learning since I've never done it before, and I'm hoping someone can point me to a resource, book, tutorial, etc., or maybe just throw some things at me to research more in-depth so I don't feel quite so in the dark.

Thanks in advance for any criticism!

Is This A Good Question/Topic? 0
  • +

Replies To: Creating a Web API Client Library?

#2 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3463
  • View blog
  • Posts: 10,669
  • Joined: 05-May 12

Re: Creating a Web API Client Library?

Posted 06 January 2014 - 10:21 PM

Although this is in C#, rather than C++, consider the what the client API library looks like for sending email. There is the class SmtpClient, MailMessage, and MailAddress classes which wraps the entire Web API for send email as defined by the SMTP protocol.

Notice how the client API abstracts away the "how-to"/procedural approach described in the RFC, and instead exposes more of an object oriented approach. This is what I consider a good client API library.
Was This Post Helpful? 0
  • +
  • -

#3 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3463
  • View blog
  • Posts: 10,669
  • Joined: 05-May 12

Re: Creating a Web API Client Library?

Posted 06 January 2014 - 10:33 PM

Creating an API is an art, more than a science.

Consider the original Windows C API for dealing with HTTP sessions. It was horrible to use. Almost everybody I knew wrote a wrapper around it to make it better. But then if you compare the API versus the web API as defined by the HTTP protocol, it was technically correct, just not very usable.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1