- page 61
Summary
This chapter explored Amazon API, initially using both the REST and SOAP protocols, then
concentrating
on the SOAP protocol for the more detailed examples. Several different
methods
of exploring the Amazon API were introduced: searching by Keyword, Author, and finally the ASIN. A few different uses for the information were explored, such as to allow tracking of prices and sales rank over time. Finally, the concept of a personal store was introduced, allowing you to present selected items to your users on an ongoing basis. Key elements of this chapter included the following:
-
An introduction to the API itself
-
Presentation of a sample REST request
-
Introducing several different SOAP search formats
-
Examples demonstrating different uses of the API
You now have the information you need to
incorporate
the Amazon API into your site. By presenting products available from Amazon to your customers (you could, for example, link product reviews to the appropriate Amazon item), you not only give your
visitors
an easy way to order the product, but you also
open
up a
valuable
revenue stream for your site. The
next
chapter introduces the FedEx API, to allow you to automatically view cost shipments, generate shipping labels, track packages, and accept returns.
Chapter 8:
Interacting with the FedEx API
Overview
Federal Express (FedEx) is an international brand
name
in express shipping. By accessing its API you can not only save time and effort when it comes to shipping products to your customers, but you can also give your customers more information. You can provide information on the various shipment
methods
available to them, as well as detailed tracking information on their orders after they have been shipped. Finally, in the unfortunate case that a customer needs to return a product, FedEx (and thus the API) also eases that process.
This chapter covers several of the most useful API calls:
-
Registering your account number to obtain a meter number
-
Determining which FedEx delivery services are available between given addresses
-
Obtaining rate information for a given service
-
Shipping a package
-
Canceling a shipment
-
Tracking a package
-
Accepting returns
Registering to Use the API
Unfortunately, the steps involved in accessing the API
differ
internationally. The rules in the United States seem to be quite simple — simply
open
a business shipping account and request access. You will then be provided with an account number. In other
countries
, however (Canada, for example), the process can be a bit more involved, and may require signing a
nondisclosure
agreement. This chapter covers the process from the U.S. perspective, but if you live elsewhere, I recommend speaking to FedEx representatives on the phone. I found that once I actually reached someone on the phone directly, things moved a lot more smoothly.
First, obtain a commercial FedEx account. This is as simple as filling out the appropriate forms on the website (
www.fedex.com
). You will need a major credit card. If you have any problems, I recommend calling the toll-free number, because whoever answers the phone is a lot more helpful and lenient with requirements than the website is.
Second, request access to the API. You're going to need to send an email to
websupport@fedex.com
(or your regional office) and request access to the API, as well as the URL for the test server. The URL isn't published
anywhere
(and to respect that, it isn't in this book either), and you might as well save yourself an email and get it at the same time.
Third, use the account number you've received to execute a subscription request. This will give you a meter number. You must include both your account number and this meter number with all your
requests
. You only need to make the request once, but save the meter number forever.