SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Hybrid View

  1. #1
    SitePoint Zealot nacworld's Avatar
    Join Date
    Aug 2008
    Location
    TEXAS
    Posts
    107
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Web Services - Where To Start?

    Hello guys,

    I really have no idea how the Web Services work?

    I heard it often in the company I worked before when they were integrating our software with a third party software that handles newsletter sending (email company)...

    Can someone show me where I need to start learning it so I can also work with Web Services...

    Thanks

  2. #2
    SitePoint Member
    Join Date
    Jul 2012
    Location
    Minnesota
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi nac,

    I know it's been a little bit since you posted this, but I noticed that nobody responded to your thread yet. Web services has to do with computer systems exchanging information in a formalized manner. When you hear phrases like "We're integrating our software with a third party web service....", what they're really saying is that they're setting up the ability for your software and the third party's software to talk to each other for some purpose. Unfortunately, computers cannot communicate like you or I, so they depend on a set of formal rules for exchanging data. These formal rules are generally called an API.

    There are two ways that web services are used: to get data from a third party and to push data to a third party. I don't know for sure about your situation, but from the description you gave, it sounds like your company was probably pushing data to the third party. I'm going to take some liberties here with the imagination to illustrate a point, so forgive me if this doesn't match what your organization actually does.

    From a business perspective, your company has decided to use the third party to handle their newsletters. Probably, they're very good at sending newsletters, and to get the same quality in house would cost an arm and a leg. So they've entered into an agreement to use their services instead.

    The problem comes in though every time you guys have a new customer. Someone has to pick up the phone or email and say "Hey Mike, this is Jim over at XYZ corporation, and we have 3 more people we need to add to our newsletter listing". Here's where web services become useful. A web service would allow you to set up a programmatic trigger so that every time a new customer registers your software, the customer is automatically signed up for the newsletter. Nobody has to talk to each other over the phone or email. The computers talk to one another and everything happens somewhat magically through this information exchange.

    On a more technical level, almost every API has a formal set of syntax for how the information is passed back and forth. To give you a real world example, here's the documentation for a particular method of Twitter's API:

    https://dev.twitter.com/docs/api/1/get/followers/ids

    This method returns data to you about who is following the specified user. You can see from the documentation that you need to provide either a screen_name or user_id value when you send your request for data. Once your request has been processed, it will send you back data containing information about the people following the specified user id (see the example section at the bottom).

    Every web service works differently, they use different syntax and rules for communicating. If you wanted to integrate with a particular web service (Facebook, Twitter, etc), you would review the documentation for that service and start writing code from there.

    I hope this brief primer was useful to you. Have a good day!

  3. #3
    SitePoint Zealot nacworld's Avatar
    Join Date
    Aug 2008
    Location
    TEXAS
    Posts
    107
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi codeatar,

    It's nice to see you with a very detailed explanation...

    Yes, my old company used API between email marketing company, we had over a million email database and API was used to unsubscribe, adding new subscribers from our website and pushing the email marketing results to our CRM and so on...

    I have seen also some other API documentations but I still couldn't figure out to develop myself, is there any API integration example demos in PHP for example? that would help me a lot I'm not expert with PHP but I'm also not bad.

    Thanks

    Quote Originally Posted by codeatar View Post
    Hi nac,

    I know it's been a little bit since you posted this, but I noticed that nobody responded to your thread yet. Web services has to do with computer systems exchanging information in a formalized manner. When you hear phrases like "We're integrating our software with a third party web service....", what they're really saying is that they're setting up the ability for your software and the third party's software to talk to each other for some purpose. Unfortunately, computers cannot communicate like you or I, so they depend on a set of formal rules for exchanging data. These formal rules are generally called an API.

    There are two ways that web services are used: to get data from a third party and to push data to a third party. I don't know for sure about your situation, but from the description you gave, it sounds like your company was probably pushing data to the third party. I'm going to take some liberties here with the imagination to illustrate a point, so forgive me if this doesn't match what your organization actually does.

    From a business perspective, your company has decided to use the third party to handle their newsletters. Probably, they're very good at sending newsletters, and to get the same quality in house would cost an arm and a leg. So they've entered into an agreement to use their services instead.

    The problem comes in though every time you guys have a new customer. Someone has to pick up the phone or email and say "Hey Mike, this is Jim over at XYZ corporation, and we have 3 more people we need to add to our newsletter listing". Here's where web services become useful. A web service would allow you to set up a programmatic trigger so that every time a new customer registers your software, the customer is automatically signed up for the newsletter. Nobody has to talk to each other over the phone or email. The computers talk to one another and everything happens somewhat magically through this information exchange.

    On a more technical level, almost every API has a formal set of syntax for how the information is passed back and forth. To give you a real world example, here's the documentation for a particular method of Twitter's API:

    https://dev.twitter.com/docs/api/1/get/followers/ids

    This method returns data to you about who is following the specified user. You can see from the documentation that you need to provide either a screen_name or user_id value when you send your request for data. Once your request has been processed, it will send you back data containing information about the people following the specified user id (see the example section at the bottom).

    Every web service works differently, they use different syntax and rules for communicating. If you wanted to integrate with a particular web service (Facebook, Twitter, etc), you would review the documentation for that service and start writing code from there.

    I hope this brief primer was useful to you. Have a good day!

  4. #4
    SitePoint Member
    Join Date
    Jul 2012
    Location
    Minnesota
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Typically the way these integrations happen in the PHP world is through the curl library. I looked around to see if I could find something fairly straightforward and not overly complicated for you to have a look at. FreshBooks is an online invoicing platform that I have some personal experience with. On their sample code page:

    http://developers.freshbooks.com/sample-code/

    There is a code sample titled csv2item.zip. This is a simple example on how to take raw CSV data and create a FreshBooks line item with it. I didn't write the code, but it is a concise example of consuming their web service for a purpose. If you open the file you can see that the author has defined a small function to handle talking with the API server via curl. The rest of the file is the form and it's processing code. You'll nice the data that is being sent to the FreshBooks service is XML. This is fairly typical for a data exchange. HTTPS POST (key,value pairs) is another common format, but you won't see that method used in the example.

    The real value for you will come from comparing the code in the file to the documentation page of the Freshbooks API for the method being called in the example:

    http://developers.freshbooks.com/doc...s/#item.create

    Obviously you wouldn't be able to test this code out on your own without a FreshBooks account, and even then I'm not sure it would be all that useful to you. But it should give an idea of how these sort of interactions typically look under the hood and how one goes about translating that API documentation to real world code.

    Hope that helps!

  5. #5
    SitePoint Zealot nacworld's Avatar
    Join Date
    Aug 2008
    Location
    TEXAS
    Posts
    107
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks codeatar,

    I now understand better where to start learning for api integrations...


    Quote Originally Posted by codeatar View Post
    Typically the way these integrations happen in the PHP world is through the curl library. I looked around to see if I could find something fairly straightforward and not overly complicated for you to have a look at. FreshBooks is an online invoicing platform that I have some personal experience with. On their sample code page:

    http://developers.freshbooks.com/sample-code/

    There is a code sample titled csv2item.zip. This is a simple example on how to take raw CSV data and create a FreshBooks line item with it. I didn't write the code, but it is a concise example of consuming their web service for a purpose. If you open the file you can see that the author has defined a small function to handle talking with the API server via curl. The rest of the file is the form and it's processing code. You'll nice the data that is being sent to the FreshBooks service is XML. This is fairly typical for a data exchange. HTTPS POST (key,value pairs) is another common format, but you won't see that method used in the example.

    The real value for you will come from comparing the code in the file to the documentation page of the Freshbooks API for the method being called in the example:

    http://developers.freshbooks.com/doc...s/#item.create

    Obviously you wouldn't be able to test this code out on your own without a FreshBooks account, and even then I'm not sure it would be all that useful to you. But it should give an idea of how these sort of interactions typically look under the hood and how one goes about translating that API documentation to real world code.

    Hope that helps!

  6. #6
    SitePoint Member imsas's Avatar
    Join Date
    Feb 2011
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The two main types of web services used in most web applications are SOAP and REST.. Do a google on both to learn how to implement them..
    ___________________________________________________________________
    IMSAS Background Check - Background Check API
    PeopleSearchWorld.com - People Search
    CabinPay - Credit Card Processing


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •