API causes an application to wait for a response from
the API in order to continue processing data or function
normally. This can lead to interruptions in application
processing as delay in responses or failed responses
could cause the application to hang or stop performing
the way it was intended to work. This might occur, for
example, if an application relies on some piece of
information to be retrieved from another API before it
can continue functioning. For example, uploading videos
to YouTube was originally a synchronous use case. While
the videos were uploading, users couldn’t use the rest of
the GUI or change the names of the videos or make other
changes. Users had to wait until the process completed
prior to doing any other work within the YouTube
application. Figure 6-2 provides an example of a
synchronous process.
Figure 6-2 Synchronous API Call Example
Asynchronous APIs do exactly the opposite of
synchronous APIs in that they do not wait until a
response is received prior to continuing to function and
process other aspects of data. Asynchronous APIs
provide a callback function so that the API response can
be sent back at another time, without the application
having to wait for the entire transaction to complete. As
an example of an asynchronous API, today you can
upload a video to YouTube, and while it’s uploading,